From 6e8ec6f1db49403762b3e5884048a02070136a7a Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 06:15:47 -1000 Subject: Name the right file and error in the scan logs A failed stat logged the directory rather than the entry inside it, and a project list that failed to read printed strerror of the flag ferror returns, which names an unrelated error. --- source/scan-tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/scan-tree.c b/source/scan-tree.c index b941ec5..7e7f28b 100644 --- a/source/scan-tree.c +++ b/source/scan-tree.c @@ -32,7 +32,7 @@ static int stat_entry(const char *dir, const char *name, struct stat *st) // A missing entry is the ordinary answer for a directory that is not a // repository, so only some other failure is worth reporting. if (err && errno != ENOENT) - fprintf(stderr, "[cgit] Unable to stat %s: %s (%d)\n", dir, strerror(errno), errno); + fprintf(stderr, "[cgit] Unable to stat %s: %s (%d)\n", path.buf, strerror(errno), errno); strbuf_release(&path); return err; } @@ -363,7 +363,8 @@ void scan_projects(const char *path, const char *projectsfile) strbuf_insert(&line, 0, path, strlen(path)); scan_path(path, line.buf); } - if ((err = ferror(projects))) { + if (ferror(projects)) { + err = errno; fprintf(stderr, "[cgit] Unable to read project list %s: %s (%d)\n", projectsfile, strerror(err), err); } -- cgit