summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2010-08-03 12:13:53 +0200
committerKay Sievers <kay.sievers@vrfy.org>2010-08-03 12:13:53 +0200
commit8e5a620b17c08b0b6277236203ee559b7dadd1d4 (patch)
tree0b4691bd09d6798900585fb525c5d6d987bc9b1d /udev
parent4ab3c463d418c74275eb8170a87c8cf75e47d973 (diff)
call util_delete_path() only when we actually deleted stuff
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-node.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/udev/udev-node.c b/udev/udev-node.c
index 8339eb732f..228b3ebee4 100644
--- a/udev/udev-node.c
+++ b/udev/udev-node.c
@@ -298,15 +298,15 @@ static void link_update(struct udev_device *dev, const char *slink, bool add)
if (!add) {
dbg(udev, "removing index: '%s'\n", filename);
- unlink(filename);
- util_delete_path(udev, filename);
+ if (unlink(filename) == 0)
+ rmdir(dirname);
}
target = link_find_prioritized(dev, add, dirname, buf, sizeof(buf));
if (target == NULL) {
info(udev, "no reference left, remove '%s'\n", slink);
- unlink(slink);
- util_delete_path(udev, slink);
+ if (unlink(slink) == 0)
+ util_delete_path(udev, slink);
} else {
info(udev, "creating link '%s' to '%s'\n", slink, target);
node_symlink(udev, target, slink);
@@ -427,7 +427,8 @@ int udev_node_remove(struct udev_device *dev)
info(udev, "removing device node '%s'\n", devnode);
err = util_unlink_secure(udev, devnode);
- util_delete_path(udev, devnode);
+ if (err == 0)
+ util_delete_path(udev, devnode);
out:
return err;
}