summaryrefslogtreecommitdiff
path: root/src/basic/user-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-04-19 11:40:48 +0200
committerLennart Poettering <lennart@poettering.net>2018-04-19 11:41:28 +0200
commitad80c6a65546154354725092b6235f3e3556ca02 (patch)
treea7381ddf15764f6524d012f9349f1be0b14573aa /src/basic/user-util.c
parent5b3325fedfefff4f7077faf20abf8a831fbf9474 (diff)
downloadsystemd-ad80c6a65546154354725092b6235f3e3556ca02.tar.gz
systemd-ad80c6a65546154354725092b6235f3e3556ca02.tar.bz2
systemd-ad80c6a65546154354725092b6235f3e3556ca02.zip
user-util: trivial coding style fixes
Use C's downgrade-to-bool feature when comparing pointers against NULL, as we usually do.
Diffstat (limited to 'src/basic/user-util.c')
-rw-r--r--src/basic/user-util.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index 0f0f21dbcf..1adb2366d8 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -775,11 +775,11 @@ int fgetpwent_sane(FILE *stream, struct passwd **pw) {
errno = 0;
p = fgetpwent(stream);
- if (p == NULL && errno != ENOENT)
+ if (!p && errno != ENOENT)
return errno > 0 ? -errno : -EIO;
*pw = p;
- return p != NULL;
+ return !!p;
}
int fgetspent_sane(FILE *stream, struct spwd **sp) {
@@ -790,11 +790,11 @@ int fgetspent_sane(FILE *stream, struct spwd **sp) {
errno = 0;
s = fgetspent(stream);
- if (s == NULL && errno != ENOENT)
+ if (!s && errno != ENOENT)
return errno > 0 ? -errno : -EIO;
*sp = s;
- return s != NULL;
+ return !!s;
}
int fgetgrent_sane(FILE *stream, struct group **gr) {
@@ -805,11 +805,11 @@ int fgetgrent_sane(FILE *stream, struct group **gr) {
errno = 0;
g = fgetgrent(stream);
- if (g == NULL && errno != ENOENT)
+ if (!g && errno != ENOENT)
return errno > 0 ? -errno : -EIO;
*gr = g;
- return g != NULL;
+ return !!g;
}
#if ENABLE_GSHADOW
@@ -821,10 +821,10 @@ int fgetsgent_sane(FILE *stream, struct sgrp **sg) {
errno = 0;
s = fgetsgent(stream);
- if (s == NULL && errno != ENOENT)
+ if (!s && errno != ENOENT)
return errno > 0 ? -errno : -EIO;
*sg = s;
- return s != NULL;
+ return !!s;
}
#endif