From 461b1822321d6be0d7fd8be29bf3b4993ebd1b85 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 9 Jul 2012 17:30:22 +0200 Subject: paranoia: refuse rm_rf("/") --- src/shared/util.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/shared') diff --git a/src/shared/util.c b/src/shared/util.c index 041a63bb4b..41505b2ca7 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -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) { -- cgit v1.2.3-54-g00ecf