summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--udev/udev-node.c25
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));