Module Name: src
Committed By: mrg
Date: Sun May 4 20:43:30 UTC 2014
Modified Files:
src/sbin/ttyflags: ttyflags.c
Log Message:
open the tty with O_RDWR|O_NONBLOCK. it seems valid to ask for
write permission when we're setting flags, and ucom(4) has an
existing workaround for a bug when O_RDWR is not used, and thus
ttyflags would not work for ucom devices.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/ttyflags/ttyflags.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/ttyflags/ttyflags.c
diff -u src/sbin/ttyflags/ttyflags.c:1.18 src/sbin/ttyflags/ttyflags.c:1.19
--- src/sbin/ttyflags/ttyflags.c:1.18 Sat Aug 27 18:58:51 2011
+++ src/sbin/ttyflags/ttyflags.c Sun May 4 20:43:30 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ttyflags.c,v 1.18 2011/08/27 18:58:51 joerg Exp $ */
+/* $NetBSD: ttyflags.c,v 1.19 2014/05/04 20:43:30 mrg Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\
#endif /* not lint */
#ifndef lint
-__RCSID("$NetBSD: ttyflags.c,v 1.18 2011/08/27 18:58:51 joerg Exp $");
+__RCSID("$NetBSD: ttyflags.c,v 1.19 2014/05/04 20:43:30 mrg Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -214,7 +214,7 @@ change_ttyflags(struct ttyent *tep)
return (0);
/* Open the device NON-BLOCKING, set the flags, and close it. */
- if ((fd = open(path, O_RDONLY | O_NONBLOCK, 0)) == -1) {
+ if ((fd = open(path, O_RDWR | O_NONBLOCK, 0)) == -1) {
if (!(errno == ENXIO ||
(errno == ENOENT && (st & TTY_ON) == 0)))
rval = 1;