From bc7ff2cd1dea92594801c89c3727ac23ca12f872 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 16 Oct 2017 15:04:48 -0400 Subject: [PATCH] lib/commit: Avoid trying to delete `.` with _CONSUME flag This helps port rpm-ostree. Closes: #1278 Approved by: jlebon --- src/libostree/ostree-repo-commit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 140ea34f..f0cc8bf4 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -3193,11 +3193,13 @@ ostree_repo_write_dfd_to_mtree (OstreeRepo *self, return FALSE; /* And now finally remove the toplevel; see also the handling for this flag in - * the write_dfd_iter_to_mtree_internal() function. + * the write_dfd_iter_to_mtree_internal() function. As a special case we don't + * try to remove `.` (since we'd get EINVAL); that's what's used in + * rpm-ostree. */ const gboolean delete_after_commit = modifier && (modifier->flags & OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CONSUME); - if (delete_after_commit) + if (delete_after_commit && !g_str_equal (path, ".")) { if (!glnx_unlinkat (dfd, path, AT_REMOVEDIR, error)) return FALSE;