From 36dddd1ca40b4abbe3352b4cb93b465f4038666e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Aug 2006 03:15:26 +0200 Subject: lookup_user, lookup_group: report "unknown user" and "lookup failed" Patch from Marco, but both cases are reported as an error. --- udev_sysdeps.c | 18 ++++++++++++------ 1 file 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; -- cgit v1.2.3-54-g00ecf