getty: more correct check for O_RDWR
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/loginutils/getty.c b/loginutils/getty.c
index 94c9147..015f077 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -268,7 +268,7 @@
* Standard input should already be connected to an open port. Make
* sure it is open for read/write.
*/
- if ((fcntl(0, F_GETFL) & O_RDWR) != O_RDWR)
+ if ((fcntl(0, F_GETFL) & (O_RDWR|O_RDONLY|O_WRONLY)) != O_RDWR)
bb_error_msg_and_die("stdin is not open for read/write");
}
}