Module Name:    src
Committed By:   christos
Date:           Wed May  2 14:36:07 UTC 2012

Modified Files:
        src/lib/libc/gen: getpass.c

Log Message:
test for both NUL and _POSIX_VDISABLE, because _POSIX_VDISABLE propagation
between different daemons and OS's does not seem reliable.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/gen/getpass.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/getpass.c
diff -u src/lib/libc/gen/getpass.c:1.25 src/lib/libc/gen/getpass.c:1.26
--- src/lib/libc/gen/getpass.c:1.25	Fri Apr 13 21:33:43 2012
+++ src/lib/libc/gen/getpass.c	Wed May  2 10:36:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getpass.c,v 1.25 2012/04/14 01:33:43 christos Exp $	*/
+/*	$NetBSD: getpass.c,v 1.26 2012/05/02 14:36:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getpass.c,v 1.25 2012/04/14 01:33:43 christos Exp $");
+__RCSID("$NetBSD: getpass.c,v 1.26 2012/05/02 14:36:07 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -172,8 +172,14 @@ getpassfd(const char *prompt, char *buf,
 			(void)write(fd[2], "\a", 1); \
 	while (/*CONSTCOND*/ 0)
 #define erase() (void)write(fd[1], "\b \b", 3)
-#define C(a, b) (gt.c_cc[(a)] == _POSIX_VDISABLE ? (b) : gt.c_cc[(a)])
-
+/*
+ * We test for both _POSIX_VDISABLE and NUL here because _POSIX_VDISABLE
+ * propagation does not seem to be very consistent on multiple daemon hops
+ * between different OS's. Perhaps we should not even bother with
+ * _POSIX_VDISABLE and use ~0 and 0 directly.
+ */
+#define C(a, b) ((gt.c_cc[(a)] == _POSIX_VDISABLE || gt.c_cc[(a)] == '\0') ? \
+    (b) : gt.c_cc[(a)])
 		if (lnext) {
 			lnext = false;
 			goto add;

Reply via email to