paranoia: refuse rm_rf("/")

This commit is contained in:
Lennart Poettering
2012-07-09 17:30:22 +02:00
parent 8401e9f91d
commit 461b182232
3 changed files with 8 additions and 1 deletions
+3
View File
@@ -3339,6 +3339,9 @@ int rm_rf(const char *path, bool only_dirs, bool delete_root, bool honour_sticky
assert(path);
/* Be paranoid */
assert(!streq(path, "/"));
fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
if (fd < 0) {