Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/pwd_mkdb - The value getdbent() returns when no rec...



details:   https://anonhg.NetBSD.org/src/rev/fe24b2748295
branches:  trunk
changeset: 746969:fe24b2748295
user:      enami <enami%NetBSD.org@localhost>
date:      Tue Aug 25 09:27:25 2009 +0000

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

diffstat:

 usr.sbin/pwd_mkdb/pwd_mkdb.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 16f166936d34 -r fe24b2748295 usr.sbin/pwd_mkdb/pwd_mkdb.c
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c      Tue Aug 25 06:58:04 2009 +0000
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c      Tue Aug 25 09:27:25 2009 +0000
@@ -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. */



Home | Main Index | Thread Index | Old Index