From 8ece36c28a3449de9dce9d43252aeb0ffc166687 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Fri, 17 Apr 2020 14:29:13 -0400 Subject: [PATCH 3/3] lib/commit: Check that dirent is a directory before cleaning I've only noticed this by inspection. But I think it's possible for `cleanup_txn_dir` to get called with the `staging-...-lock` file since it matches the prefix. Make the checking here stronger by verifying that it's a directory. If it's not a directory (lockfile), then follow the default pruning expiry logic so that we still cleanup stray lockfiles eventually. --- src/libostree/ostree-repo-commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 8c4bd3fe..7dd68e96 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -2011,7 +2011,7 @@ cleanup_tmpdir (OstreeRepo *self, continue; /* Handle transaction tmpdirs */ - if (_ostree_repo_has_staging_prefix (dent->d_name)) + if (_ostree_repo_has_staging_prefix (dent->d_name) && S_ISDIR (stbuf.st_mode)) { if (!cleanup_txn_dir (self, dfd_iter.fd, dent->d_name, cancellable, error)) return FALSE; -- 2.25.1