Diff options
Diffstat (limited to 'source/scan-tree.c')
| -rw-r--r-- | source/scan-tree.c | 8 |
1 file changed, 6 insertions, 2 deletions
diff --git a/source/scan-tree.c b/source/scan-tree.c index f29738c..ec991e0 100644 --- a/source/scan-tree.c +++ b/source/scan-tree.c @@ -219,9 +219,13 @@ static void add_repo(const char *base, struct strbuf *path) current_repo->url[urllen] = '\0'; } if (!current_repo->owner) { + // A uid with no passwd entry is no error, and getpwuid tells + // the two apart only by setting errno on a failure. + errno = 0; if (!(pwd = getpwuid(st.st_uid))) { - fprintf(stderr, "[cgit] Unable to read the owner of %s: %s (%d)\n", - path->buf, strerror(errno), errno); + if (errno) + fprintf(stderr, "[cgit] Unable to read the owner of %s: %s (%d)\n", + path->buf, strerror(errno), errno); } else { // A gecos field puts the owner's name in front of a // comma separated list of office and phone details. |
