diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/drivers/chan_kern.c | 3 | ||||
-rw-r--r-- | arch/um/drivers/chan_user.c | 11 | ||||
-rw-r--r-- | arch/um/drivers/line.c | 9 |
3 files changed, 16 insertions, 7 deletions
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index c09dbdfa298a..db3082b4da46 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c | |||
@@ -291,6 +291,9 @@ int write_chan(struct list_head *chans, const char *buf, int len, | |||
291 | struct chan *chan = NULL; | 291 | struct chan *chan = NULL; |
292 | int n, ret = 0; | 292 | int n, ret = 0; |
293 | 293 | ||
294 | if (len == 0) | ||
295 | return 0; | ||
296 | |||
294 | list_for_each(ele, chans) { | 297 | list_for_each(ele, chans) { |
295 | chan = list_entry(ele, struct chan, list); | 298 | chan = list_entry(ele, struct chan, list); |
296 | if (!chan->output || (chan->ops->write == NULL)) | 299 | if (!chan->output || (chan->ops->write == NULL)) |
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c index 77557e233f58..d29e56d8ced4 100644 --- a/arch/um/drivers/chan_user.c +++ b/arch/um/drivers/chan_user.c | |||
@@ -38,7 +38,16 @@ int generic_read(int fd, char *c_out, void *unused) | |||
38 | 38 | ||
39 | int generic_write(int fd, const char *buf, int n, void *unused) | 39 | int generic_write(int fd, const char *buf, int n, void *unused) |
40 | { | 40 | { |
41 | return write(fd, buf, n); | 41 | int err; |
42 | |||
43 | err = write(fd, buf, n); | ||
44 | if (err > 0) | ||
45 | return err; | ||
46 | else if (errno == EAGAIN) | ||
47 | return 0; | ||
48 | else if (err == 0) | ||
49 | return -EIO; | ||
50 | return -errno; | ||
42 | } | 51 | } |
43 | 52 | ||
44 | int generic_window_size(int fd, void *unused, unsigned short *rows_out, | 53 | int generic_window_size(int fd, void *unused, unsigned short *rows_out, |
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 3e0b68e297f2..b4538dfb4820 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
@@ -216,18 +216,15 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len) | |||
216 | { | 216 | { |
217 | struct line *line = tty->driver_data; | 217 | struct line *line = tty->driver_data; |
218 | unsigned long flags; | 218 | unsigned long flags; |
219 | int n, err, ret = 0; | 219 | int n, ret = 0; |
220 | 220 | ||
221 | if(tty->stopped) | 221 | if(tty->stopped) |
222 | return 0; | 222 | return 0; |
223 | 223 | ||
224 | spin_lock_irqsave(&line->lock, flags); | 224 | spin_lock_irqsave(&line->lock, flags); |
225 | if (line->head != line->tail) { | 225 | if (line->head != line->tail) |
226 | ret = buffer_data(line, buf, len); | 226 | ret = buffer_data(line, buf, len); |
227 | err = flush_buffer(line); | 227 | else { |
228 | if (err <= 0 && (err != -EAGAIN || !ret)) | ||
229 | ret = err; | ||
230 | } else { | ||
231 | n = write_chan(&line->chan_list, buf, len, | 228 | n = write_chan(&line->chan_list, buf, len, |
232 | line->driver->write_irq); | 229 | line->driver->write_irq); |
233 | if (n < 0) { | 230 | if (n < 0) { |