diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2010-04-12 15:51:16 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2010-04-12 15:51:16 +0200 |
commit | 0ec5b5e1429307fa7573aaa9b8f25fbd9b1d71d5 (patch) | |
tree | c2652aa96e2e9512f39b410099c7c40d476bf671 /udev/udev-node.c | |
parent | 421fbc71c7e951dac900eabd445dfe577158b9c3 (diff) |
unify/cleanup event handling
Diffstat (limited to 'udev/udev-node.c')
-rw-r--r-- | udev/udev-node.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/udev/udev-node.c b/udev/udev-node.c index 3aee15b584..3b4eb5f00b 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2009 Kay Sievers <kay.sievers@vrfy.org> + * Copyright (C) 2003-2010 Kay Sievers <kay.sievers@vrfy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -416,7 +416,6 @@ int udev_node_remove(struct udev_device *dev) const char *devnode; char partitionname[UTIL_PATH_SIZE]; struct stat stats; - struct udev_device *dev_check; int err = 0; int num; @@ -436,15 +435,21 @@ int udev_node_remove(struct udev_device *dev) return -1; } - dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); - if (dev_check != NULL && stats.st_rdev == udev_device_get_devnum(dev_check)) { - /* do not remove device node if the same sys-device is re-created in the meantime */ - info(udev, "keeping device node of existing device'%s'\n", devnode); + if (udev_device_get_ignore_remove(dev)) { + info(udev, "ignore_remove for '%s'\n", udev_device_get_devnode(dev)); } else { - info(udev, "removing device node '%s'\n", devnode); - err = util_unlink_secure(udev, devnode); + struct udev_device *dev_check; + + dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); + if (dev_check != NULL && stats.st_rdev == udev_device_get_devnum(dev_check)) { + /* do not remove device node if the same sys-device is re-created in the meantime */ + info(udev, "keeping device node of existing device'%s'\n", devnode); + } else { + info(udev, "removing device node '%s'\n", devnode); + err = util_unlink_secure(udev, devnode); + } + udev_device_unref(dev_check); } - udev_device_unref(dev_check); num = udev_device_get_num_fake_partitions(dev); if (num > 0) { @@ -459,6 +464,7 @@ int udev_node_remove(struct udev_device *dev) util_unlink_secure(udev, partitionname); } } + util_delete_path(udev, devnode); return err; } |