summaryrefslogtreecommitdiff
path: root/arch/um/drivers/chan_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers/chan_user.c')
-rw-r--r--arch/um/drivers/chan_user.c11
1 files changed, 10 insertions, 1 deletions
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)
int generic_write(int fd, const char *buf, int n, void *unused)
{
- return write(fd, buf, n);
+ int err;
+
+ err = write(fd, buf, n);
+ if (err > 0)
+ return err;
+ else if (errno == EAGAIN)
+ return 0;
+ else if (err == 0)
+ return -EIO;
+ return -errno;
}
int generic_window_size(int fd, void *unused, unsigned short *rows_out,