diff options
author | Kay Sievers <kay.sievers@suse.de> | 2006-08-18 03:15:26 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2006-08-18 03:15:26 +0200 |
commit | 36dddd1ca40b4abbe3352b4cb93b465f4038666e (patch) | |
tree | 9efe69e2bb70fa91907a898b4428781928ec4276 | |
parent | 2362eea6019e07a2e79e67ebe626bfacf40ff40f (diff) |
lookup_user, lookup_group: report "unknown user" and "lookup failed"
Patch from Marco, but both cases are reported as an error.
-rw-r--r-- | udev_sysdeps.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/udev_sysdeps.c b/udev_sysdeps.c index 152b7f0c5c..c0b2d70b6e 100644 --- a/udev_sysdeps.c +++ b/udev_sysdeps.c @@ -98,9 +98,12 @@ uid_t lookup_user(const char *user) uid_t uid = 0; pw = getpwnam(user); - if (pw == NULL) - err("error resolving user '%s': %s", user, strerror(errno)); - else + if (pw == NULL) { + if (errno == 0) + err("specified user unknown '%s'", user); + else + err("error resolving user '%s': %s", user, strerror(errno)); + } else uid = pw->pw_uid; return uid; @@ -112,9 +115,12 @@ gid_t lookup_group(const char *group) gid_t gid = 0; gr = getgrnam(group); - if (gr == NULL) - err("error resolving group '%s': %s", group, strerror(errno)); - else + if (gr == NULL) { + if (errno == 0) + err("specified group unknown '%s'", group); + else + err("error resolving group '%s': %s", group, strerror(errno)); + } else gid = gr->gr_gid; return gid; |