diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/cache.c | 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rw-r--r-- | source/cgit.c | 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rw-r--r-- | source/html.c | 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rw-r--r-- | source/scan-tree.c | 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rw-r--r-- | source/shared.c | 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rw-r--r-- | source/ui-log.c | 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
6 files changed, 26 insertions, 20 deletions
diff --git a/source/cache.c b/source/cache.c index 682f225..dd8ae7f 100644 --- a/source/cache.c +++ b/source/cache.c @@ -169,7 +169,7 @@ static int serve_slot(struct cache_slot *slot) err = print_slot(slot); if (err) - log_error("[cgit] error printing cache %s: %s (%d)\n", + log_error("[cgit] Error printing slot %s: %s (%d)\n", slot->path, strerror(err), err); @@ -394,7 +394,7 @@ static int process_slot(struct cache_slot *slot) // alternating visit. Nothing else makes that visible, because the // cache keeps working and only quietly stops helping. if (!err) - log_error("[cgit] cache slot %s holds a different key, " + log_error("[cgit] Cache slot %s holds a different key, " "consider a larger cache-size\n", slot->path); // If any part of creating a slot fails the page is still rendered @@ -402,14 +402,14 @@ static int process_slot(struct cache_slot *slot) // because it did. close_slot(slot); if ((err = lock_slot(slot)) != 0) { - log_error("[cgit] Unable to lock slot %s: %s (%d)\n", + log_error("[cgit] Error locking slot %s: %s (%d)\n", slot->lock_path, strerror(err), err); slot->fn(); return 0; } if ((err = fill_slot(slot)) != 0) { - log_error("[cgit] Unable to fill slot %s: %s (%d)\n", + log_error("[cgit] Error filling slot %s: %s (%d)\n", slot->lock_path, strerror(err), err); unlock_slot(slot, 0); close_lock(slot); @@ -535,13 +535,13 @@ int cache_ls(const char *path) int keylen; if (!path) { - log_error("[cgit] cache path not specified\n"); + log_error("[cgit] Cache path not specified\n"); return -1; } dir = opendir(path); if (!dir) { err = errno; - log_error("[cgit] unable to open path %s: %s (%d)\n", + log_error("[cgit] Error opening %s: %s (%d)\n", path, strerror(err), err); return err; } @@ -555,7 +555,7 @@ int cache_ls(const char *path) strbuf_addstr(&slot_path, ent->d_name); slot.path = slot_path.buf; if ((err = open_slot(&slot)) != 0) { - log_error("[cgit] unable to open path %s: %s (%d)\n", + log_error("[cgit] Error opening %s: %s (%d)\n", slot_path.buf, strerror(err), err); continue; } diff --git a/source/cgit.c b/source/cgit.c index 42325a0..37b07d7 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -366,8 +366,13 @@ static int generate_cached_repolist(const char *path, const char *cached_rc) } if (fcntl(fd, F_SETLK, &lock) < 0) { // A lock held elsewhere only means concurrent requests, which - // is not worth a line in the server log. + // is not worth a line in the server log. Any other failure, a + // filesystem without lock support say, silently costs a scan + // on every request and does deserve one. err = errno; + if (err != EACCES && err != EAGAIN) + fprintf(stderr, "[cgit] Error locking %s: %s (%d)\n", + locked_rc.buf, strerror(err), err); close(fd); goto out; } diff --git a/source/html.c b/source/html.c index ae8acd6..2e4ec66 100644 --- a/source/html.c +++ b/source/html.c @@ -83,7 +83,7 @@ char *cgit_fmt(const char *format, ...) len = vsnprintf(buf[slot], sizeof(buf[slot]), format, args); va_end(args); if (len < 0 || (size_t)len >= sizeof(buf[slot])) { - fprintf(stderr, "[html.c] string truncated: %s\n", format); + fprintf(stderr, "[cgit] String truncated: %s\n", format); exit(1); } return buf[slot]; @@ -384,7 +384,7 @@ int html_include(const char *filename) size_t len; if (!(f = fopen(filename, "r"))) { - fprintf(stderr, "[cgit] Failed to include file %s: %s (%d).\n", + fprintf(stderr, "[cgit] Error including file %s: %s (%d)\n", filename, strerror(errno), errno); return -1; } diff --git a/source/scan-tree.c b/source/scan-tree.c index 3528d43..ac74eb3 100644 --- a/source/scan-tree.c +++ b/source/scan-tree.c @@ -31,7 +31,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, "Error checking path %s: %s (%d)\n", + fprintf(stderr, "[cgit] Error checking path %s: %s (%d)\n", dir, strerror(errno), errno); strbuf_release(&path); return err; @@ -125,7 +125,7 @@ static void add_repo(const char *base, struct strbuf *path) size_t desc_size; if (stat(path->buf, &st)) { - fprintf(stderr, "Error accessing %s: %s (%d)\n", + fprintf(stderr, "[cgit] Error accessing %s: %s (%d)\n", path->buf, strerror(errno), errno); return; } @@ -174,7 +174,7 @@ static void add_repo(const char *base, struct strbuf *path) current_repo->path = cgit_strdup_first_line(path->buf); while (!current_repo->owner) { if ((pwd = getpwuid(st.st_uid)) == NULL) { - fprintf(stderr, "Error reading owner-info for %s: %s (%d)\n", + fprintf(stderr, "[cgit] Error reading owner-info for %s: %s (%d)\n", path->buf, strerror(errno), errno); break; } @@ -230,7 +230,7 @@ static void scan_path(const char *base, const char *path) struct stat st; if (!dir) { - fprintf(stderr, "Error opening directory %s: %s (%d)\n", + fprintf(stderr, "[cgit] Error opening directory %s: %s (%d)\n", path, strerror(errno), errno); return; } @@ -254,7 +254,7 @@ static void scan_path(const char *base, const char *path) strbuf_setlen(&pathbuf, pathlen); strbuf_addstr(&pathbuf, ent->d_name); if (stat(pathbuf.buf, &st)) { - fprintf(stderr, "Error checking path %s: %s (%d)\n", + fprintf(stderr, "[cgit] Error checking path %s: %s (%d)\n", pathbuf.buf, strerror(errno), errno); continue; } @@ -274,7 +274,7 @@ void scan_projects(const char *path, const char *projectsfile) projects = fopen(projectsfile, "r"); if (!projects) { - fprintf(stderr, "Error opening projectsfile %s: %s (%d)\n", + fprintf(stderr, "[cgit] Error opening projectsfile %s: %s (%d)\n", projectsfile, strerror(errno), errno); return; } @@ -286,7 +286,7 @@ void scan_projects(const char *path, const char *projectsfile) scan_path(path, line.buf); } if ((err = ferror(projects))) { - fprintf(stderr, "Error reading from projectsfile %s: %s (%d)\n", + fprintf(stderr, "[cgit] Error reading from projectsfile %s: %s (%d)\n", projectsfile, strerror(err), err); } fclose(projects); diff --git a/source/shared.c b/source/shared.c index d5ff7c4..48d587d 100644 --- a/source/shared.c +++ b/source/shared.c @@ -514,8 +514,9 @@ void cgit_prepare_repo_env(struct cgit_repo *repo) for (i = 0; i < ARRAY_SIZE(vars); i++) if (vars[i].value && setenv(vars[i].name, vars[i].value, 1)) fprintf(stderr, - "cgit warning: failed to set env: %s=%s\n", - vars[i].name, vars[i].value); + "[cgit] Error setting env %s=%s: %s (%d)\n", + vars[i].name, vars[i].value, + strerror(errno), errno); } int cgit_read_first_line(const char *path, char **buf, size_t *size) diff --git a/source/ui-log.c b/source/ui-log.c index 6c428f3..ec5f91b 100644 --- a/source/ui-log.c +++ b/source/ui-log.c @@ -492,7 +492,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, strvec_pop(&rev_argv); while ((arg = next_token(&pattern))) { if (*arg == '-') { - fprintf(stderr, "Bad range expr: %s\n", + fprintf(stderr, "[cgit] Bad range expression: %s\n", arg); break; } |
