diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-11-01 13:33:33 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-11-01 13:33:33 +0100 |
commit | dbfb57058683ae054bf910815072851f52e69a20 (patch) | |
tree | 1c5b1ed052bdf56b07549a362716f8537e7effa1 | |
parent | 45197c02a5274f291b79346a7bb294096e6ee512 (diff) |
do not skip /dev/{disk,char}/M:m removal when the device node is already gone
-rw-r--r-- | udev/udev-node.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/udev/udev-node.c b/udev/udev-node.c index f19dc4d900..44d3686db6 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -416,20 +416,19 @@ int udev_node_remove(struct udev_device *dev) if (devnode == NULL) goto out; - if (stat(devnode, &stats) != 0) { - info(udev, "device node '%s' not found\n", devnode); - goto out; - } - - if (stats.st_rdev != udev_device_get_devnum(dev)) { - info(udev, "device node '%s' points to a different device, skip removal\n", devnode); - err = -1; - goto out; - } + if (stat(devnode, &stats) == 0) { + if (stats.st_rdev != udev_device_get_devnum(dev)) { + info(udev, "device node '%s' points to a different device, skip removal\n", devnode); + err = -1; + goto out; + } - if (stats.st_mode & 01000) { - info(udev, "device node '%s' has sticky bit set, skip removal\n", devnode); - goto out; + if (stats.st_mode & 01000) { + info(udev, "device node '%s' has sticky bit set, skip removal\n", devnode); + goto out; + } + } else { + info(udev, "device node '%s' not found\n", devnode); } dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); |