Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ttyflags open the tty with O_RDWR|O_NONBLOCK. it seems...



details:   https://anonhg.NetBSD.org/src/rev/aeccc051cd14
branches:  trunk
changeset: 329072:aeccc051cd14
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun May 04 20:43:30 2014 +0000

description:
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.

diffstat:

 sbin/ttyflags/ttyflags.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 77013954a3da -r aeccc051cd14 sbin/ttyflags/ttyflags.c
--- a/sbin/ttyflags/ttyflags.c  Sun May 04 17:06:23 2014 +0000
+++ b/sbin/ttyflags/ttyflags.c  Sun May 04 20:43:30 2014 +0000
@@ -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 @@
 #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 @@
                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;



Home | Main Index | Thread Index | Old Index