summaryrefslogtreecommitdiff
path: root/src/shared/edit-util.c
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2023-03-15 19:38:19 +0800
committerMike Yuan <me@yhndnzj.com>2023-03-15 19:50:26 +0800
commitd3bf024f1a7de82361999c6fd130d3f37283600f (patch)
tree38bea6a303e3a4d84f04b34e7f5b71e269814124 /src/shared/edit-util.c
parent00b6baf2be6b9365a092d720715a278250fd7dd3 (diff)
downloadsystemd-d3bf024f1a7de82361999c6fd130d3f37283600f.tar.gz
edit-util: log unexpected errors if we fail to remove the parent dir
Diffstat (limited to 'src/shared/edit-util.c')
-rw-r--r--src/shared/edit-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
index 195075ba97..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);