Don't wait on stdin if read count 0
authorKevin Klues <klueska@cs.berkeley.edu>
Sat, 7 Jun 2014 06:19:38 +0000 (23:19 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Sat, 7 Jun 2014 06:19:38 +0000 (23:19 -0700)
kern/src/devfs.c

index d63e7f6..2cc2764 100644 (file)
@@ -82,6 +82,9 @@ ssize_t dev_stdin_read(struct file *file, char *buf, size_t count,
 {
        char c;
        extern struct kb_buffer cons_buf;
+
+       if (!count)
+               return 0;
        kb_get_from_buf(&cons_buf, &c, 1);
        /* TODO UMEM */
        if (current)