summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-25 20:41:53 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-12-02 12:18:54 +0100
commitf030d36cd0a48856b6970541bd5baf74c2c06449 (patch)
treea34df4742253515f4c11c39044229fed8c574124 /src
parentlldp: rename lldp_neighbor_id_hash_ops and set value destructor (diff)
downloadsystemd-f030d36cd0a48856b6970541bd5baf74c2c06449.tar.xz
systemd-f030d36cd0a48856b6970541bd5baf74c2c06449.zip
sysusers: use fgetgrent_sane()
Diffstat (limited to 'src')
-rw-r--r--src/sysusers/sysusers.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index c2326ee9b8..3eb70f5e8f 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -140,8 +140,7 @@ static int load_group_database(void) {
if (r < 0)
return r;
- errno = 0;
- while ((gr = fgetgrent(f))) {
+ while ((r = fgetgrent_sane(f, &gr)) > 0) {
char *n;
int k, q;
@@ -164,13 +163,8 @@ static int load_group_database(void) {
if (k <= 0 && q <= 0)
free(n);
-
- errno = 0;
}
- if (!IN_SET(errno, 0, ENOENT))
- return -errno;
-
- return 0;
+ return r;
}
static int make_backup(const char *target, const char *x) {