summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-03-10 02:46:26 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:51:00 -0700
commit783272f045faf39325678eef0d55a41d7306e2d3 (patch)
tree4885a45c5af8adb2b302679f7a84a557ecc74639
parent138068d690d79e71239d3e776f01560afbabc1cb (diff)
[PATCH] don't lookup "root" in the userdb
-rw-r--r--udev_add.c20
-rw-r--r--udev_utils.c4
2 files changed, 15 insertions, 9 deletions
diff --git a/udev_add.c b/udev_add.c
index f47ca25f74..58f4ee1150 100644
--- a/udev_add.c
+++ b/udev_add.c
@@ -114,8 +114,8 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de
char filename[PATH_SIZE];
char partitionname[PATH_SIZE];
struct name_entry *name_loop;
- uid_t uid = 0;
- gid_t gid = 0;
+ uid_t uid;
+ gid_t gid;
int tail;
int i;
@@ -126,24 +126,30 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de
if (strchr(udev->name, '/'))
create_path(filename);
- if (udev->owner[0] != '\0') {
+ if (strcmp(udev->owner, "root") == 0)
+ uid = 0;
+ else {
char *endptr;
- unsigned long id = strtoul(udev->owner, &endptr, 10);
+ unsigned long id;
+ id = strtoul(udev->owner, &endptr, 10);
if (endptr[0] == '\0')
uid = (uid_t) id;
else
uid = lookup_user(udev->owner);
}
- if (udev->group[0] != '\0') {
+ if (strcmp(udev->group, "root") == 0)
+ gid = 0;
+ else {
char *endptr;
- unsigned long id = strtoul(udev->group, &endptr, 10);
+ unsigned long id;
+ id = strtoul(udev->group, &endptr, 10);
if (endptr[0] == '\0')
gid = (gid_t) id;
else
- gid = lookup_group(udev->group);
+ gid = lookup_user(udev->group);
}
if (!udev->test_run) {
diff --git a/udev_utils.c b/udev_utils.c
index d572581f65..afa9790fdc 100644
--- a/udev_utils.c
+++ b/udev_utils.c
@@ -85,8 +85,8 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs
}
udev->mode = 0660;
- strcpy(udev->owner, "0");
- strcpy(udev->group, "0");
+ strcpy(udev->owner, "root");
+ strcpy(udev->group, "root");
return 0;
}