From 2ef5de1bd95cbcdab7efb6c3a35871c8a2786894 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti de Araujo Date: Tue, 3 Apr 2018 10:05:11 -0300 Subject: [PATCH] tmpfiles: fix directory removal with force symlink (#8619) symlink_atomic returns -EISDIR when the target symlink path is a directory. Fixes #7447 Signed-off-by: Ricardo Salveti --- src/tmpfiles/tmpfiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 61e76570b1..d04f24065b 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -1665,7 +1665,7 @@ static int create_item(Item *i) { r = symlink_atomic(i->argument, i->path); mac_selinux_create_file_clear(); - if (IN_SET(r, -EEXIST, -ENOTEMPTY)) { + if (IN_SET(r, -EISDIR, -EEXIST, -ENOTEMPTY)) { r = rm_rf(i->path, REMOVE_ROOT|REMOVE_PHYSICAL); if (r < 0) return log_error_errno(r, "rm -fr %s failed: %m", i->path);