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 Fix the "separate root" test. If we get a ...



details:   https://anonhg.NetBSD.org/src/rev/80e907c5bfa5
branches:  trunk
changeset: 326339:80e907c5bfa5
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 26 01:57:04 2014 +0000

description:
Fix the "separate root" test. If we get a permission error check for separate
root. But if we get ENOENT, always succeed. Otherwise if someone removes
the db files or they get corrupted, you can never recreate them.

diffstat:

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

diffs (27 lines):

diff -r e8980003d685 -r 80e907c5bfa5 usr.sbin/pwd_mkdb/pwd_mkdb.c
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c      Sun Jan 26 00:21:18 2014 +0000
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c      Sun Jan 26 01:57:04 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pwd_mkdb.c,v 1.56 2012/11/26 20:13:54 pooka Exp $      */
+/*     $NetBSD: pwd_mkdb.c,v 1.57 2014/01/26 01:57:04 christos Exp $   */
 
 /*
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  The NetBSD Foundation, Inc.  All rights reserved.\
   Copyright (c) 1991, 1993, 1994\
  The Regents of the University of California.  All rights reserved.");
-__RCSID("$NetBSD: pwd_mkdb.c,v 1.56 2012/11/26 20:13:54 pooka Exp $");
+__RCSID("$NetBSD: pwd_mkdb.c,v 1.57 2014/01/26 01:57:04 christos Exp $");
 #endif /* not lint */
 
 #if HAVE_NBTOOL_CONFIG_H
@@ -741,7 +741,7 @@
        db = dbopen(fname, O_RDONLY, PERM_INSECURE, DB_HASH, NULL);
        if (db == NULL) {
                /* If we are building on a separate root, assume version 1 */
-               if ((errno == EACCES || errno == ENOENT) && prefix[0])
+               if ((errno == EACCES && prefix[0]) || errno == ENOENT)
                        return 1;
                mkpw_warning("Cannot open database `%s'", fname);
                bailout();



Home | Main Index | Thread Index | Old Index