chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4a336a6
)
util.c: simplify rm_rf_children_dangerous
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 18 Jun 2014 16:43:02 +0000
(12:43 -0400)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Fri, 20 Jun 2014 00:08:44 +0000
(20:08 -0400)
src/shared/util.c
patch
|
blob
|
history
diff --git
a/src/shared/util.c
b/src/shared/util.c
index bce4e634c23537ae7ede93520ae0898496be5d75..34e91762bc01d123499c09def03c78597020644b 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-2671,7
+2671,7
@@
finish:
}
int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev) {
}
int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev) {
-
DIR *d
;
+
_cleanup_closedir_ DIR *d = NULL
;
int ret = 0;
assert(fd >= 0);
int ret = 0;
assert(fd >= 0);
@@
-2694,15
+2694,12
@@
int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct
errno = 0;
de = readdir(d);
errno = 0;
de = readdir(d);
- if (!de
&& errno != 0
) {
- if (ret == 0)
+ if (!de) {
+ if (
errno != 0 &&
ret == 0)
ret = -errno;
ret = -errno;
-
break
;
+
return ret
;
}
}
- if (!de)
- break;
-
if (streq(de->d_name, ".") || streq(de->d_name, ".."))
continue;
if (streq(de->d_name, ".") || streq(de->d_name, ".."))
continue;
@@
-2758,10
+2755,6
@@
int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct
}
}
}
}
}
}
-
- closedir(d);
-
- return ret;
}
_pure_ static int is_temporary_fs(struct statfs *s) {
}
_pure_ static int is_temporary_fs(struct statfs *s) {