aboutsummaryrefslogtreecommitdiffstats
path: root/commit-graph.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-06-08 14:27:51 -0700
committerJunio C Hamano <gitster@pobox.com>2022-06-08 14:27:51 -0700
commitf02e23405f51d761168d81d117fde4b816abbd2f (patch)
tree48fad31d065cf3bb0d2ef123f7e1a26e446728d4 /commit-graph.c
parentMerge branch 'jc/archive-add-file-normalize-mode' into maint (diff)
parentcommit-graph.c: don't assume that stat() succeeds (diff)
downloadgit-f02e23405f51d761168d81d117fde4b816abbd2f.tar.gz
git-f02e23405f51d761168d81d117fde4b816abbd2f.zip
Merge branch 'ab/valgrind-fixes' into maint
A bit of test framework fixes with a few fixes to issues found by valgrind. source: <20220512223218.237544-1-gitster@pobox.com> * ab/valgrind-fixes: commit-graph.c: don't assume that stat() succeeds object-file: fix a unpack_loose_header() regression in 3b6a8db3b03 log test: skip a failing mkstemp() test under valgrind tests: using custom GIT_EXEC_PATH breaks --valgrind tests
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/commit-graph.c b/commit-graph.c
index 441b36016b..2b52818731 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -2206,7 +2206,8 @@ static void mark_commit_graphs(struct write_commit_graph_context *ctx)
struct stat st;
struct utimbuf updated_time;
- stat(ctx->commit_graph_filenames_before[i], &st);
+ if (stat(ctx->commit_graph_filenames_before[i], &st) < 0)
+ continue;
updated_time.actime = st.st_atime;
updated_time.modtime = now;
@@ -2247,7 +2248,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
strbuf_setlen(&path, dirnamelen);
strbuf_addstr(&path, de->d_name);
- stat(path.buf, &st);
+ if (stat(path.buf, &st) < 0)
+ continue;
if (st.st_mtime > expire_time)
continue;