diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-03-16 03:51:55 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-16 03:51:55 +0900 |
commit | 0e5b4d767ab364961f5d369aab9347da60fe4625 (patch) | |
tree | 668c3a80425d9ea900007842a5cf567997c9c1e4 /src/shared | |
parent | 3ec58d0cd8f64bb9f23ba25153f5dacfe3514b01 (diff) | |
parent | d3bf024f1a7de82361999c6fd130d3f37283600f (diff) | |
download | systemd-0e5b4d767ab364961f5d369aab9347da60fe4625.tar.gz |
Merge pull request #26831 from YHNdnzj/edit-util-followup
edit-util: follow-ups
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/edit-util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c index 0c0e1416fc..58cd7fe9f3 100644 --- a/src/shared/edit-util.c +++ b/src/shared/edit-util.c @@ -32,8 +32,8 @@ void edit_file_context_done(EditFileContext *context) { r = path_extract_directory(i->path, &parent); if (r < 0) log_debug_errno(r, "Failed to extract directory from '%s', ignoring: %m", i->path); - else /* No need to check if the dir is empty, rmdir does nothing if it is not the case. */ - (void) rmdir(parent); + else if (rmdir(parent) < 0 && !IN_SET(errno, ENOENT, ENOTEMPTY)) + log_debug_errno(errno, "Failed to remove parent directory '%s', ignoring: %m", parent); } free(i->path); @@ -50,7 +50,7 @@ bool edit_files_contains(const EditFileContext *context, const char *path) { assert(path); FOREACH_ARRAY(i, context->files, context->n_files) - if (streq(i->path, path)) + if (path_equal(i->path, path)) return true; return false; |