Module Name: src Committed By: christos Date: Sun Jan 26 01:57:04 UTC 2014
Modified Files: src/usr.sbin/pwd_mkdb: pwd_mkdb.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 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.56 src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.57 --- src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.56 Mon Nov 26 15:13:54 2012 +++ src/usr.sbin/pwd_mkdb/pwd_mkdb.c Sat Jan 25 20:57:04 2014 @@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 2000, 20 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 @@ getversion(const char *fname) 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();