diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/drivers/chan_user.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c index 96f3a477c95e..5d3768156c92 100644 --- a/arch/um/drivers/chan_user.c +++ b/arch/um/drivers/chan_user.c | |||
@@ -143,22 +143,22 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out) | |||
143 | { | 143 | { |
144 | struct winch_data data; | 144 | struct winch_data data; |
145 | unsigned long stack; | 145 | unsigned long stack; |
146 | int fds[2], pid, n, err; | 146 | int fds[2], n, err; |
147 | char c; | 147 | char c; |
148 | 148 | ||
149 | err = os_pipe(fds, 1, 1); | 149 | err = os_pipe(fds, 1, 1); |
150 | if(err < 0){ | 150 | if(err < 0){ |
151 | printk("winch_tramp : os_pipe failed, err = %d\n", -err); | 151 | printk("winch_tramp : os_pipe failed, err = %d\n", -err); |
152 | return(err); | 152 | goto out; |
153 | } | 153 | } |
154 | 154 | ||
155 | data = ((struct winch_data) { .pty_fd = fd, | 155 | data = ((struct winch_data) { .pty_fd = fd, |
156 | .pipe_fd = fds[1], | 156 | .pipe_fd = fds[1], |
157 | .close_me = fds[0] } ); | 157 | .close_me = fds[0] } ); |
158 | pid = run_helper_thread(winch_thread, &data, 0, &stack, 0); | 158 | err = run_helper_thread(winch_thread, &data, 0, &stack, 0); |
159 | if(pid < 0){ | 159 | if(err < 0){ |
160 | printk("fork of winch_thread failed - errno = %d\n", errno); | 160 | printk("fork of winch_thread failed - errno = %d\n", errno); |
161 | return(pid); | 161 | goto out_close; |
162 | } | 162 | } |
163 | 163 | ||
164 | os_close_file(fds[1]); | 164 | os_close_file(fds[1]); |
@@ -168,14 +168,22 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out) | |||
168 | printk("winch_tramp : failed to read synchronization byte\n"); | 168 | printk("winch_tramp : failed to read synchronization byte\n"); |
169 | printk("read failed, err = %d\n", -n); | 169 | printk("read failed, err = %d\n", -n); |
170 | printk("fd %d will not support SIGWINCH\n", fd); | 170 | printk("fd %d will not support SIGWINCH\n", fd); |
171 | pid = -1; | 171 | err = -EINVAL; |
172 | goto out_close1; | ||
172 | } | 173 | } |
173 | return(pid); | 174 | return err ; |
175 | |||
176 | out_close: | ||
177 | os_close_file(fds[1]); | ||
178 | out_close1: | ||
179 | os_close_file(fds[0]); | ||
180 | out: | ||
181 | return err; | ||
174 | } | 182 | } |
175 | 183 | ||
176 | void register_winch(int fd, struct tty_struct *tty) | 184 | void register_winch(int fd, struct tty_struct *tty) |
177 | { | 185 | { |
178 | int pid, thread, thread_fd; | 186 | int pid, thread, thread_fd = -1; |
179 | int count; | 187 | int count; |
180 | char c = 1; | 188 | char c = 1; |
181 | 189 | ||