summaryrefslogtreecommitdiff
path: root/namedev_parse.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-11-29 13:44:01 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:00:29 -0700
commit5f72c470ad244020f65784c33eb6bcd4ae149403 (patch)
tree5d590e591eb0b4af32aa1e1ba62ebbabd01da847 /namedev_parse.c
parent927bda379205dfccd2fae8f5c54523230e0771a9 (diff)
[PATCH] simplify permission handling
Initialize the defaults in udev_config.c instead of namedev.c. Replace macro by expanded code. Switch to mode_t instead of string value. Add and clarify some comments.
Diffstat (limited to 'namedev_parse.c')
-rw-r--r--namedev_parse.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/namedev_parse.c b/namedev_parse.c
index d39141bfc7..5b8c5ab2d6 100644
--- a/namedev_parse.c
+++ b/namedev_parse.c
@@ -79,12 +79,19 @@ static int add_perm_dev(struct perm_device *new_dev)
struct perm_device *dev;
struct perm_device *tmp_dev;
- /* update the values if we already have the device */
+ /* if we already have that entry, just update the values */
list_for_each_entry(dev, &perm_device_list, node) {
if (strcmp(new_dev->name, dev->name) != 0)
continue;
- set_empty_perms(dev, new_dev->mode, new_dev->owner, new_dev->group);
+ /* don't overwrite values from earlier entries */
+ if (dev->mode == 0000)
+ dev->mode = new_dev->mode;
+ if (dev->owner[0] == '\0')
+ strfieldcpy(dev->owner, new_dev->owner);
+ if (dev->owner[0] == '\0')
+ strfieldcpy(dev->group, new_dev->group);
+
return 0;
}
@@ -95,7 +102,8 @@ static int add_perm_dev(struct perm_device *new_dev)
memcpy(tmp_dev, new_dev, sizeof(*tmp_dev));
list_add_tail(&tmp_dev->node, &perm_device_list);
- //dump_perm_dev(tmp_dev);
+ /* dump_perm_dev(tmp_dev); */
+
return 0;
}