summaryrefslogtreecommitdiff
path: root/udev/udev-util.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-10-21 12:43:07 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-10-21 12:43:07 +0200
commit20254eb02172d5763556ce5c50ce3a3c6c1d3070 (patch)
tree9723fca563373221e4633003b3e2d2a6f0b7574e /udev/udev-util.c
parent94db05d28837d8c419b1110c79c71e1025ac58ac (diff)
add "root" == 0 shortcuts to lookup_user/group()
Diffstat (limited to 'udev/udev-util.c')
-rw-r--r--udev/udev-util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/udev/udev-util.c b/udev/udev-util.c
index d45d444e97..76445bbcdc 100644
--- a/udev/udev-util.c
+++ b/udev/udev-util.c
@@ -129,6 +129,8 @@ uid_t util_lookup_user(struct udev *udev, const char *user)
struct passwd *pw;
uid_t uid = 0;
+ if (strcmp(user, "root") == 0)
+ return 0;
errno = 0;
pw = getpwnam(user);
if (pw == NULL) {
@@ -138,7 +140,6 @@ uid_t util_lookup_user(struct udev *udev, const char *user)
err(udev, "error resolving user '%s': %m\n", user);
} else
uid = pw->pw_uid;
-
return uid;
}
@@ -147,6 +148,8 @@ extern gid_t util_lookup_group(struct udev *udev, const char *group)
struct group *gr;
gid_t gid = 0;
+ if (strcmp(group, "root") == 0)
+ return 0;
errno = 0;
gr = getgrnam(group);
if (gr == NULL) {
@@ -156,7 +159,6 @@ extern gid_t util_lookup_group(struct udev *udev, const char *group)
err(udev, "error resolving group '%s': %m\n", group);
} else
gid = gr->gr_gid;
-
return gid;
}