Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19977
b: refs/heads/master
c: 1d2ddcf
h: refs/heads/master
i:
  19975: 61042b2
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed Feb 8, 2006
1 parent 4983448 commit 8fd3d11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fbd5577901388ff9306a05eb63648c30e4722134
refs/heads/master: 1d2ddcfb1935c9c0e98c4295458b01f24e3274f9
15 changes: 7 additions & 8 deletions trunk/arch/um/drivers/chan_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <termios.h>
#include <string.h>
#include <signal.h>
#include <sched.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
Expand Down Expand Up @@ -73,7 +74,6 @@ static void winch_handler(int sig)
struct winch_data {
int pty_fd;
int pipe_fd;
int close_me;
};

static int winch_thread(void *arg)
Expand All @@ -84,7 +84,6 @@ static int winch_thread(void *arg)
int count, err;
char c = 1;

os_close_file(data->close_me);
pty_fd = data->pty_fd;
pipe_fd = data->pipe_fd;
count = os_write_file(pipe_fd, &c, sizeof(c));
Expand Down Expand Up @@ -153,29 +152,29 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out)
}

data = ((struct winch_data) { .pty_fd = fd,
.pipe_fd = fds[1],
.close_me = fds[0] } );
err = run_helper_thread(winch_thread, &data, 0, &stack, 0);
.pipe_fd = fds[1] } );
/* CLONE_FILES so this thread doesn't hold open files which are open
* now, but later closed. This is a problem with /dev/net/tun.
*/
err = run_helper_thread(winch_thread, &data, CLONE_FILES, &stack, 0);
if(err < 0){
printk("fork of winch_thread failed - errno = %d\n", errno);
goto out_close;
}

os_close_file(fds[1]);
*fd_out = fds[0];
n = os_read_file(fds[0], &c, sizeof(c));
if(n != sizeof(c)){
printk("winch_tramp : failed to read synchronization byte\n");
printk("read failed, err = %d\n", -n);
printk("fd %d will not support SIGWINCH\n", fd);
err = -EINVAL;
goto out_close1;
goto out_close;
}
return err ;

out_close:
os_close_file(fds[1]);
out_close1:
os_close_file(fds[0]);
out:
return err;
Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/um/os-Linux/drivers/tuntap_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote,
return(-EINVAL);
}
*fd_out = ((int *) CMSG_DATA(cmsg))[0];
os_set_exec_close(*fd_out, 1);
return(0);
}

Expand All @@ -137,7 +138,8 @@ static int tuntap_open(void *data)
return(err);

if(pri->fixed_config){
pri->fd = os_open_file("/dev/net/tun", of_rdwr(OPENFLAGS()), 0);
pri->fd = os_open_file("/dev/net/tun",
of_cloexec(of_rdwr(OPENFLAGS())), 0);
if(pri->fd < 0){
printk("Failed to open /dev/net/tun, err = %d\n",
-pri->fd);
Expand Down

0 comments on commit 8fd3d11

Please sign in to comment.