diff options
author | sheldonh <sheldonh@FreeBSD.org> | 1999-12-02 16:39:15 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 1999-12-02 16:39:15 +0000 |
commit | 8d21f19e4ea884b8f28e4feb635e0e5617096a14 (patch) | |
tree | 83232d6f4c25b8cc5173adbfa3341f49e4ae58e8 /lib | |
parent | 3f39219a8d9387cceebfd86d69f447cdc5604478 (diff) | |
download | FreeBSD-src-8d21f19e4ea884b8f28e4feb635e0e5617096a14.zip FreeBSD-src-8d21f19e4ea884b8f28e4feb635e0e5617096a14.tar.gz |
Replace the -q option to pwd_mkdb with a test for PW_SCAN_BIG_IDS in
the environment. This allows big ID warnings to be suppressed for
vipw and chpass as well.
Since the environment variable test is only performed for callers
of pw_scan() that do not set pw_big_ids_warning, the test can still
be overriden. Currently, chpass and pwd_mkdb are the only users
of pw_scan() and neither of them overrides the environment variable
test.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/pw_scan.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libc/gen/pw_scan.c b/lib/libc/gen/pw_scan.c index 09556a3..849effa 100644 --- a/lib/libc/gen/pw_scan.c +++ b/lib/libc/gen/pw_scan.c @@ -60,8 +60,12 @@ static const char rcsid[] = * Some software assumes that IDs are short. We should emit warnings * for id's which can not be stored in a short, but we are more liberal * by default, warning for IDs greater than USHRT_MAX. + * + * If pw_big_ids_warning is anything other than -1 on entry to pw_scan() + * it will be set based on the existance of PW_SCAN_BIG_IDS in the + * environment. */ -int pw_big_ids_warning = 1; +int pw_big_ids_warning = -1; int pw_scan(bp, pw) @@ -72,6 +76,9 @@ pw_scan(bp, pw) int root; char *p, *sh; + if (pw_big_ids_warning == -1) + pw_big_ids_warning = getenv("PW_SCAN_BIG_IDS") == NULL ? 1 : 0; + pw->pw_fields = 0; if (!(pw->pw_name = strsep(&bp, ":"))) /* login */ goto fmt; |