summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2019-07-06 13:02:34 +1000
committerDarren Tucker <dtucker@dtucker.net>2019-07-06 13:02:34 +1000
commit4c3e00b1ed7e596610f34590eb5d54ee50d77878 (patch)
tree646e12361a847bb01aa1e3da580077a723e9ff5a /openbsd-compat
parent2753521e899f30d1d58b5da0b4e68fde6fcf341e (diff)
Cast *ID types to unsigned long when printing.
UID and GID types vary by platform so cast to u_long and use %lu when printing them to prevent warnings.
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/bsd-setres_id.c12
-rw-r--r--openbsd-compat/pwcache.c4
2 files changed, 8 insertions, 8 deletions
diff --git a/openbsd-compat/bsd-setres_id.c b/openbsd-compat/bsd-setres_id.c
index 696ae7b2..a8e76bf6 100644
--- a/openbsd-compat/bsd-setres_id.c
+++ b/openbsd-compat/bsd-setres_id.c
@@ -37,20 +37,20 @@ setresgid(gid_t rgid, gid_t egid, gid_t sgid)
#if defined(HAVE_SETREGID) && !defined(BROKEN_SETREGID)
if (setregid(rgid, egid) < 0) {
saved_errno = errno;
- error("setregid %u: %.100s", rgid, strerror(errno));
+ error("setregid %lu: %.100s", (u_long)rgid, strerror(errno));
errno = saved_errno;
ret = -1;
}
#else
if (setegid(egid) < 0) {
saved_errno = errno;
- error("setegid %u: %.100s", (u_int)egid, strerror(errno));
+ error("setegid %lu: %.100s", (u_long)egid, strerror(errno));
errno = saved_errno;
ret = -1;
}
if (setgid(rgid) < 0) {
saved_errno = errno;
- error("setgid %u: %.100s", rgid, strerror(errno));
+ error("setgid %ul: %.100s", (u_long)rgid, strerror(errno));
errno = saved_errno;
ret = -1;
}
@@ -72,7 +72,7 @@ setresuid(uid_t ruid, uid_t euid, uid_t suid)
#if defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID)
if (setreuid(ruid, euid) < 0) {
saved_errno = errno;
- error("setreuid %u: %.100s", ruid, strerror(errno));
+ error("setreuid %lu: %.100s", (u_long)ruid, strerror(errno));
errno = saved_errno;
ret = -1;
}
@@ -81,14 +81,14 @@ setresuid(uid_t ruid, uid_t euid, uid_t suid)
# ifndef SETEUID_BREAKS_SETUID
if (seteuid(euid) < 0) {
saved_errno = errno;
- error("seteuid %u: %.100s", euid, strerror(errno));
+ error("seteuid %lu: %.100s", (u_long)euid, strerror(errno));
errno = saved_errno;
ret = -1;
}
# endif
if (setuid(ruid) < 0) {
saved_errno = errno;
- error("setuid %u: %.100s", ruid, strerror(errno));
+ error("setuid %lu: %.100s", (u_long)ruid, strerror(errno));
errno = saved_errno;
ret = -1;
}
diff --git a/openbsd-compat/pwcache.c b/openbsd-compat/pwcache.c
index 5a8b7880..826c2378 100644
--- a/openbsd-compat/pwcache.c
+++ b/openbsd-compat/pwcache.c
@@ -67,7 +67,7 @@ user_from_uid(uid_t uid, int nouser)
if ((pw = getpwuid(uid)) == NULL) {
if (nouser)
return (NULL);
- (void)snprintf(nbuf, sizeof(nbuf), "%u", uid);
+ (void)snprintf(nbuf, sizeof(nbuf), "%lu", (u_long)uid);
}
cp->uid = uid;
if (cp->name != NULL)
@@ -102,7 +102,7 @@ group_from_gid(gid_t gid, int nogroup)
if ((gr = getgrgid(gid)) == NULL) {
if (nogroup)
return (NULL);
- (void)snprintf(nbuf, sizeof(nbuf), "%u", gid);
+ (void)snprintf(nbuf, sizeof(nbuf), "%lu", (u_long)gid);
}
cp->gid = gid;
if (cp->name != NULL)