From 496519fc07dd85d7d8b1ef6438436f31c1879cff Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 19 Apr 2004 17:48:32 +0000 Subject: Don't complain when the /nonexistent homedir does not exist. Based on a patch from Sam Smith. henning@ OK --- usr.sbin/user/defs.h | 4 +++- usr.sbin/user/user.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/user/defs.h b/usr.sbin/user/defs.h index 2d3ca7dc17b..4bf2eeada8e 100644 --- a/usr.sbin/user/defs.h +++ b/usr.sbin/user/defs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: defs.h,v 1.3 2002/08/12 00:42:56 aaron Exp $ */ +/* $OpenBSD: defs.h,v 1.4 2004/04/19 17:48:31 millert Exp $ */ /* $NetBSD: defs.h,v 1.5 1999/12/24 09:08:49 agc Exp $ */ /* @@ -60,4 +60,6 @@ #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif +#define _PATH_NONEXISTENT "/nonexistent" + #endif /* !DEFS_H_ */ diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c index 98aeaa7807f..af62c52b7e7 100644 --- a/usr.sbin/user/user.c +++ b/usr.sbin/user/user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: user.c,v 1.56 2004/02/26 21:18:18 millert Exp $ */ +/* $OpenBSD: user.c,v 1.57 2004/04/19 17:48:31 millert Exp $ */ /* $NetBSD: user.c,v 1.69 2003/04/14 17:40:07 agc Exp $ */ /* @@ -1028,7 +1028,8 @@ adduser(char *login_name, user_t *up) warnx("Warning: expire time `%s' invalid, password expiry off", up->u_expire); } - if (lstat(home, &st) < 0 && !(up->u_flags & F_MKDIR)) { + if (lstat(home, &st) < 0 && !(up->u_flags & F_MKDIR) && + strcmp(home, _PATH_NONEXISTENT) != 0) { warnx("Warning: home directory `%s' doesn't exist, and -m was" " not specified", home); } -- cgit v1.2.3