chiark / gitweb /
util: make sure rm_rf() can be called on symlinks (with the effect of deleting it)
[elogind.git] / src / shared / util.c
index 91cf6705ea104233b6ede6f8ef03c7f7084b57a9..dbae55fe38d127014d1c9b107695d4c48a5246fb 100644 (file)
@@ -3069,7 +3069,7 @@ static int rm_rf_internal(const char *path, bool only_dirs, bool delete_root, bo
         fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
         if (fd < 0) {
 
-                if (errno != ENOTDIR)
+                if (errno != ENOTDIR && errno != ELOOP)
                         return -errno;
 
                 if (!dangerous) {