summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pwd_mkdb
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2019-10-17 21:54:28 +0000
committermillert <millert@openbsd.org>2019-10-17 21:54:28 +0000
commitb4de0548946752b02f28ecae80da4996de54dba4 (patch)
treea11fc262d51263d0f66eccd58489afb4383935ae /usr.sbin/pwd_mkdb
parentFix some compiler warings in ifconfig(8). Move all prototypes and (diff)
downloadwireguard-openbsd-b4de0548946752b02f28ecae80da4996de54dba4.tar.xz
wireguard-openbsd-b4de0548946752b02f28ecae80da4996de54dba4.zip
Use -1 to indicate an invalid uid/gid, not UID_MAX and GID_MAX.
This is the userland portion. OK deraadt@ sashan@
Diffstat (limited to 'usr.sbin/pwd_mkdb')
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c
index 40555109559..14b435944c0 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd_mkdb.c,v 1.56 2019/06/28 13:32:49 deraadt Exp $ */
+/* $OpenBSD: pwd_mkdb.c,v 1.57 2019/10/17 21:54:29 millert Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -210,7 +210,7 @@ main(int argc, char **argv)
;
memcpy(&olduid, p, sizeof(olduid));
} else
- olduid = UID_MAX;
+ olduid = -1;
(dp->close)(dp);
}
@@ -227,7 +227,7 @@ main(int argc, char **argv)
}
if (!edp)
fatal("%s", buf);
- if (fchown(edp->fd(edp), (uid_t)-1, shadow) != 0)
+ if (fchown(edp->fd(edp), -1, shadow) != 0)
warn("%s: unable to set group to %s", _PATH_SMP_DB,
SHADOW_GROUP);
else if (fchmod(edp->fd(edp), PERM_SECURE|S_IRGRP) != 0)
@@ -502,7 +502,7 @@ write_old_entry(FILE *to, const struct passwd *pw)
else
snprintf(gidstr, sizeof(gidstr), "%u", (u_int)pw->pw_gid);
- if (pw->pw_uid == (uid_t)-1)
+ if (pw->pw_uid == -1)
strlcpy(uidstr, "-1", sizeof(uidstr));
else
snprintf(uidstr, sizeof(uidstr), "%u", (u_int)pw->pw_uid);
@@ -556,7 +556,7 @@ db_store(FILE *fp, FILE *oldfp, DB *edp, DB *dp, struct passwd *pw,
continue;
found = 1;
/* If the uid changed, remove the old record by uid. */
- if (olduid != UID_MAX && olduid != pw->pw_uid) {
+ if (olduid != -1 && olduid != pw->pw_uid) {
tbuf[0] = _PW_KEYBYUID;
memcpy(tbuf + 1, &olduid, sizeof(olduid));
key.size = sizeof(olduid) + 1;
@@ -632,7 +632,7 @@ db_store(FILE *fp, FILE *oldfp, DB *edp, DB *dp, struct passwd *pw,
}
if (firsttime) {
firsttime = 0;
- if (username && !found && olduid != UID_MAX)
+ if (username && !found && olduid != -1)
fatalx("can't find user in master.passwd");
}
}