Subject: lib/25371: manpage for cfmakeraw should explicitly state tcgetattr required
To: None <gnats-bugs@gnats.netbsd.org>
From: None <vax@carolina.rr.com>
List: netbsd-bugs
Date: 04/28/2004 18:42:24
>Number:         25371
>Category:       lib
>Synopsis:       manpage for cfmakeraw should explicitly state tcgetattr required
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 28 22:43:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     VaX#n8
>Release:        NetBSD 1.6.2
>Organization:
	
>Environment:
	
	
Machine: i386
>Description:
	
Basically, you can't just called cfmakeraw.
You have to tcgetattr first.
If you don't, you have undefined behavior.
This behavior changes depending on optimization levels.
Thus, this appears to be an annoying compiler bug but isn't.
>How-To-Repeat:
	
>Fix:

Index: NetBSD/lib/libc/termios/tcsetattr.3
diff -u NetBSD/lib/libc/termios/tcsetattr.3:1.1.1.1 NetBSD/lib/libc/termios/tcsetattr.3:1.2
--- NetBSD/lib/libc/termios/tcsetattr.3:1.1.1.1	Thu Apr  8 12:56:23 2004
+++ NetBSD/lib/libc/termios/tcsetattr.3	Wed Apr 28 18:39:56 2004
@@ -183,7 +183,9 @@
 .Pp
 The
 .Nm cfmakeraw
-function sets the flags stored in the termios structure to a state disabling
+function sets the flags stored in the termios structure initialized by
+.Nm tcgetattr
+to a state disabling
 all input and output processing, giving a
 .Dq raw I/O path .
 It should be noted that there is no function to reverse this effect.
>Release-Note:
>Audit-Trail:
>Unformatted: