diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-05-16 22:04:02 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-05-16 22:04:02 +0200 |
commit | 3cf1a8e36ed0d9bb9b000adf36dd347e8d988478 (patch) | |
tree | 132994a3ad9dac2975919b53d627aed798974cc9 /udev/udev-event.c | |
parent | 4b718be86db37a37c83793ca410e8d9968e615f2 (diff) |
libudev: device - use DEVMODE from kernel as the default mode
Diffstat (limited to 'udev/udev-event.c')
-rw-r--r-- | udev/udev-event.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/udev/udev-event.c b/udev/udev-event.c index 4c51ed58e5..832abbbfce 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -43,7 +43,6 @@ struct udev_event *udev_event_new(struct udev_device *dev) event = calloc(1, sizeof(struct udev_event)); if (event == NULL) return NULL; - event->mode = 0600; event->dev = dev; event->udev = udev_device_get_udev(dev); udev_list_init(&event->run_list); @@ -1021,9 +1020,18 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, if (event->dev_db != NULL) udev_node_update_old_links(dev, event->dev_db); - /* change default 0600 to 0660 if a group is assigned */ - if (event->mode == 0600 && event->gid > 0) - event->mode = 0660; + if (!event->mode_set) { + if (udev_device_get_devnode_mode(dev) > 0) { + /* kernel supplied value */ + event->mode = udev_device_get_devnode_mode(dev); + } else if (event->gid > 0) { + /* default 0660 if a group is assigned */ + event->mode = 0660; + } else { + /* default 0600 */ + event->mode = 0600; + } + } err = udev_node_add(dev, event->mode, event->uid, event->gid); } |