From: Colin Walters Date: Mon, 16 Oct 2017 19:04:48 +0000 (-0400) Subject: lib/commit: Avoid trying to delete `.` with _CONSUME flag X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~30^2~45 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bc7ff2cd1dea92594801c89c3727ac23ca12f872;p=ostree.git lib/commit: Avoid trying to delete `.` with _CONSUME flag This helps port rpm-ostree. Closes: #1278 Approved by: jlebon --- 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;