Module Name: src Committed By: jmcneill Date: Tue Dec 20 21:07:56 UTC 2011
Modified Files: src/sys/arch/usermode/usermode: thunk.c Log Message: thunk_pollchar: use read instead of getchar To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/arch/usermode/usermode/thunk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/usermode/usermode/thunk.c diff -u src/sys/arch/usermode/usermode/thunk.c:1.48 src/sys/arch/usermode/usermode/thunk.c:1.49 --- src/sys/arch/usermode/usermode/thunk.c:1.48 Tue Dec 20 15:45:37 2011 +++ src/sys/arch/usermode/usermode/thunk.c Tue Dec 20 21:07:56 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: thunk.c,v 1.48 2011/12/20 15:45:37 reinoud Exp $ */ +/* $NetBSD: thunk.c,v 1.49 2011/12/20 21:07:56 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill <jmcne...@invisible.ca> @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #ifdef __NetBSD__ -__RCSID("$NetBSD: thunk.c,v 1.48 2011/12/20 15:45:37 reinoud Exp $"); +__RCSID("$NetBSD: thunk.c,v 1.49 2011/12/20 21:07:56 jmcneill Exp $"); #endif #include <sys/types.h> @@ -381,6 +381,7 @@ int thunk_pollchar(void) { struct pollfd fds[1]; + uint8_t c; fds[0].fd = STDIN_FILENO; fds[0].events = POLLIN; @@ -388,7 +389,9 @@ thunk_pollchar(void) if (poll(fds, __arraycount(fds), 0) > 0) { if (fds[0].revents & POLLIN) { - return getchar(); + if (read(STDIN_FILENO, &c, 1) != 1) + return EOF; + return c; } }