]> err.no Git - systemd/commitdiff
[PATCH] don't lookup "root" in the userdb
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Thu, 10 Mar 2005 01:46:26 +0000 (02:46 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:51:00 +0000 (23:51 -0700)
udev_add.c
udev_utils.c

index f47ca25f74804c776876bde7c918cf44290d6452..58f4ee1150584b2dd4e70e0f7eafdecfeec8260c 100644 (file)
@@ -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) {
index d572581f656b1f4822dc89fc81289a984a298c33..afa9790fdc6aa17fc0e85bb0b02cf230745dbf97 100644 (file)
@@ -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;
 }