Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/user Remove the /etc/ptmp file via pw_abort(3) if t...



details:   https://anonhg.NetBSD.org/src/rev/e8f07ea9a0f6
branches:  trunk
changeset: 534908:e8f07ea9a0f6
user:      agc <agc%NetBSD.org@localhost>
date:      Tue Aug 06 09:03:55 2002 +0000

description:
Remove the /etc/ptmp file via pw_abort(3) if the pw_mkdb(3) call fails.
Addresses part of PR 17849 from Grant Beattie, grant%netbsd.org@localhost.

diffstat:

 usr.sbin/user/user.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r 6456c7aff9ef -r e8f07ea9a0f6 usr.sbin/user/user.c
--- a/usr.sbin/user/user.c      Tue Aug 06 06:54:36 2002 +0000
+++ b/usr.sbin/user/user.c      Tue Aug 06 09:03:55 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.54 2002/07/20 08:40:21 grant Exp $ */
+/* $NetBSD: user.c,v 1.55 2002/08/06 09:03:55 agc Exp $ */
 
 /*
  * Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
@@ -35,7 +35,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1999 \
                The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: user.c,v 1.54 2002/07/20 08:40:21 grant Exp $");
+__RCSID("$NetBSD: user.c,v 1.55 2002/08/06 09:03:55 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1066,10 +1066,12 @@
        (void) close(ptmpfd);
 #if PW_MKDB_ARGC == 2
        if (pw_mkdb(login_name, 0) < 0) {
+               (void) pw_abort();
                err(EXIT_FAILURE, "pw_mkdb failed");
        }
 #else
        if (pw_mkdb() < 0) {
+               (void) pw_abort();
                err(EXIT_FAILURE, "pw_mkdb failed");
        }
 #endif
@@ -1355,6 +1357,7 @@
        error = pw_mkdb();
 #endif
        if (error < 0) {
+               (void) pw_abort();
                err(EXIT_FAILURE, "pw_mkdb failed");
        }
 



Home | Main Index | Thread Index | Old Index