summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorSheldon Hearn <sheldonh@FreeBSD.org>1999-08-30 09:55:42 +0000
committerSheldon Hearn <sheldonh@FreeBSD.org>1999-08-30 09:55:42 +0000
commitd07e0690e1f62b9653262c9ad68f18d6ca54f7f7 (patch)
tree4e95fdd606e4d660d471414e8f471c02575e3c78 /libc
parent5cc3dcbb4b1ff86e884ca90d654447e83c91ac8f (diff)
downloadpw-darwin-d07e0690e1f62b9653262c9ad68f18d6ca54f7f7.tar.gz
pw-darwin-d07e0690e1f62b9653262c9ad68f18d6ca54f7f7.tar.zst
pw-darwin-d07e0690e1f62b9653262c9ad68f18d6ca54f7f7.zip
Only issue a warning for the first occurrence of a UID > USHRT_MAX and
the first occurrence of a GID > USHRT_MAX. PR: 13344 Reviewed by: bde
Diffstat (limited to 'libc')
-rw-r--r--libc/gen/pw_scan.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libc/gen/pw_scan.c b/libc/gen/pw_scan.c
index 5190686..e03b49c 100644
--- a/libc/gen/pw_scan.c
+++ b/libc/gen/pw_scan.c
@@ -56,6 +56,9 @@ static const char rcsid[] =
#include "pw_scan.h"
+static int big_uids = 0; /* Used for legacy max uid_t warning */
+static int big_gids = 0; /* Used for legacy max gid_t warning */
+
int
pw_scan(bp, pw)
char *bp;
@@ -84,9 +87,9 @@ pw_scan(bp, pw)
warnx("root uid should be 0");
return (0);
}
- if (id > USHRT_MAX) {
- warnx("%s > max uid value (%d)", p, USHRT_MAX);
- /*return (0);*/ /* THIS SHOULD NOT BE FATAL! */
+ if (id > USHRT_MAX && !(big_uids++)) {
+ warnx("%s > legacy max uid value (%d): "
+ "no more such warnings", p, USHRT_MAX);
}
pw->pw_uid = id;
@@ -94,9 +97,9 @@ pw_scan(bp, pw)
goto fmt;
if(p[0]) pw->pw_fields |= _PWF_GID;
id = atol(p);
- if (id > USHRT_MAX) {
- warnx("%s > max gid value (%d)", p, USHRT_MAX);
- /* return (0); This should not be fatal! */
+ if (id > USHRT_MAX && !(big_gids++)) {
+ warnx("%s > max gid value (%d): "
+ "no more such warnings", p, USHRT_MAX);
}
pw->pw_gid = id;