]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: 'e' is supposed to operate on directory only
authorFranck Bui <fbui@suse.com>
Tue, 24 Apr 2018 10:23:29 +0000 (12:23 +0200)
committerFranck Bui <fbui@suse.com>
Tue, 24 Apr 2018 10:23:29 +0000 (12:23 +0200)
src/tmpfiles/tmpfiles.c

index 4e437a57fd7f26b09436d02ded95a3866d3bbb7e..d52af22d735fe4d07321ce4e5c444f7a8e627460 100644 (file)
@@ -859,6 +859,9 @@ static int path_set_perms(Item *i, const char *path) {
         if (fstat(fd, &st) < 0)
                 return log_error_errno(errno, "Failed to fstat() file %s: %m", path);
 
+        if (i->type == EMPTY_DIRECTORY && !S_ISDIR(st.st_mode))
+                return log_error_errno(EEXIST, "'%s' already exists and is not a directory. ", path);
+
         return fd_set_perms(i, fd, &st);
 }