summaryrefslogtreecommitdiff
path: root/libudev/libudev-util-private.c
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 /libudev/libudev-util-private.c
parent4ab3c463d418c74275eb8170a87c8cf75e47d973 (diff)
call util_delete_path() only when we actually deleted stuff
Diffstat (limited to 'libudev/libudev-util-private.c')
-rw-r--r--libudev/libudev-util-private.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c
index 2f9f4a74c3..6b68b6a366 100644
--- a/libudev/libudev-util-private.c
+++ b/libudev/libudev-util-private.c
@@ -74,7 +74,7 @@ int util_delete_path(struct udev *udev, const char *path)
{
char p[UTIL_PATH_SIZE];
char *pos;
- int retval;
+ int err = 0;
if (path[0] == '/')
while(path[1] == '/')
@@ -92,19 +92,14 @@ int util_delete_path(struct udev *udev, const char *path)
if ((pos == p) || (pos == NULL))
break;
- /* remove if empty */
- retval = rmdir(p);
- if (errno == ENOENT)
- retval = 0;
- if (retval) {
- if (errno == ENOTEMPTY)
- return 0;
- err(udev, "rmdir(%s) failed: %m\n", p);
+ err = rmdir(p);
+ if (err < 0) {
+ if (errno == ENOENT)
+ err = 0;
break;
}
- dbg(udev, "removed '%s'\n", p);
}
- return 0;
+ return err;
}
/* Reset permissions on the device node, before unlinking it to make sure,