summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-01 19:31:53 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-12-01 19:31:53 -0500
commit4e7269063d2884374f95f1e83023006e42296533 (patch)
treeb12957ed11dae36121b7569b19340374a649dd1a /src/shared/util.c
parentf460aa149c21c920e1a3090a16877937c49b4813 (diff)
treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index ebf654a43e..23ecb1b462 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -260,7 +260,7 @@ int parse_uid(const char *s, uid_t* ret_uid) {
if ((unsigned long) uid != ul)
return -ERANGE;
- /* Some libc APIs use (uid_t) -1 as special placeholder */
+ /* Some libc APIs use UID_INVALID as special placeholder */
if (uid == (uid_t) 0xFFFFFFFF)
return -ENXIO;
@@ -949,11 +949,11 @@ int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid) {
* first change the access mode and only then hand out
* ownership to avoid a window where access is too open. */
- if (mode != (mode_t) -1)
+ if (mode != MODE_INVALID)
if (chmod(path, mode) < 0)
return -errno;
- if (uid != (uid_t) -1 || gid != (gid_t) -1)
+ if (uid != UID_INVALID || gid != GID_INVALID)
if (chown(path, uid, gid) < 0)
return -errno;
@@ -1520,9 +1520,9 @@ int getpeercred(int fd, struct ucred *ucred) {
* to namespacing issues */
if (u.pid <= 0)
return -ENODATA;
- if (u.uid == (uid_t) -1)
+ if (u.uid == UID_INVALID)
return -ENODATA;
- if (u.gid == (gid_t) -1)
+ if (u.gid == GID_INVALID)
return -ENODATA;
*ucred = u;