Module Name:    src
Committed By:   enami
Date:           Tue Aug 25 09:27:25 UTC 2009

Modified Files:
        src/usr.sbin/pwd_mkdb: pwd_mkdb.c

Log Message:
- The value getdbent() returns when no record is found is not -1 but 1.
  Testing if it returns -1 is always false.
- Use the same expression for the size to write and for the size to
  advance a pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/pwd_mkdb/pwd_mkdb.c

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

Modified files:

Index: src/usr.sbin/pwd_mkdb/pwd_mkdb.c
diff -u src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.47 src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.48
--- src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.47	Sat Jun 20 16:19:46 2009
+++ src/usr.sbin/pwd_mkdb/pwd_mkdb.c	Tue Aug 25 09:27:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwd_mkdb.c,v 1.47 2009/06/20 16:19:46 christos Exp $	*/
+/*	$NetBSD: pwd_mkdb.c,v 1.48 2009/08/25 09:27:25 enami Exp $	*/
 
 /*
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
   Copyright (c) 1991, 1993, 1994\
  The Regents of the University of California.  All rights reserved.");
 __SCCSID("from: @(#)pwd_mkdb.c	8.5 (Berkeley) 4/20/94");
-__RCSID("$NetBSD: pwd_mkdb.c,v 1.47 2009/06/20 16:19:46 christos Exp $");
+__RCSID("$NetBSD: pwd_mkdb.c,v 1.48 2009/08/25 09:27:25 enami Exp $");
 #endif /* not lint */
 
 #if HAVE_NBTOOL_CONFIG_H
@@ -475,8 +475,7 @@
 		if (newuser) {
 			if (rv == 0)
 				inconsistency();
-		} else if (rv == -1 ||
-			strcmp(username, tpwd->pw_name) != 0)
+		} else if (rv == 1 || strcmp(username, tpwd->pw_name) != 0)
 			inconsistency();
 		else if ((uid_t)olduid != pwd.pw_uid) {
 			/*
@@ -852,7 +851,7 @@
 	if (lorder != BYTE_ORDER)
 		x = SWAP(x);
 	(void)memmove(p, &x, sizeof(x));
-	p += sizeof(flags);
+	p += sizeof(x);
 	data.size = p - buf;
 
 	/* Store insecure by name. */

Reply via email to