Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/user Make "-d homedir" option work -- home director...



details:   https://anonhg.NetBSD.org/src/rev/4f7dbd109346
branches:  trunk
changeset: 483554:4f7dbd109346
user:      jlam <jlam%NetBSD.org@localhost>
date:      Sun Mar 12 19:57:24 2000 +0000

description:
Make "-d homedir" option work -- home directory wasn't being set in this
case.

diffstat:

 usr.sbin/user/user.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 24ec2f7ff6a3 -r 4f7dbd109346 usr.sbin/user/user.c
--- a/usr.sbin/user/user.c      Sun Mar 12 19:18:50 2000 +0000
+++ b/usr.sbin/user/user.c      Sun Mar 12 19:57:24 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.12 2000/03/07 20:56:45 agc Exp $ */
+/* $NetBSD: user.c,v 1.13 2000/03/12 19:57:24 jlam Exp $ */
 
 /*
  * Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
@@ -36,7 +36,7 @@
 __COPYRIGHT(
        "@(#) Copyright (c) 1999 \
                The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: user.c,v 1.12 2000/03/07 20:56:45 agc Exp $");
+__RCSID("$NetBSD: user.c,v 1.13 2000/03/12 19:57:24 jlam Exp $");
 #endif
 
 #include <sys/types.h>
@@ -710,8 +710,10 @@
                (void) pw_abort();
                errx(EXIT_FAILURE, "already a `%s' user", login);
        }
-       /* if home directory hasn't been given, make it up */
-       if (!up->u_homeset) {
+       if (up->u_homeset) {
+               (void) strlcpy(home, up->u_home, sizeof(home));
+       } else {
+               /* if home directory hasn't been given, make it up */
                (void) snprintf(home, sizeof(home), "%s/%s", up->u_basedir, login);
        }
        expire = 0;



Home | Main Index | Thread Index | Old Index