X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=daemon.c;h=a3f2ac1d81a21883c5ec7e9f1270c9109c675f12;hb=a2f8028d3d661b314d5a784764f2f5f9e4c2dde0;hp=cdbc23f63d0570fbb857357ec8b6aa2a97f2e32b;hpb=cc44c7655fe2dd0cfb46e841156634fe622df397;p=git.git diff --git a/daemon.c b/daemon.c index cdbc23f63..a3f2ac1d8 100644 --- a/daemon.c +++ b/daemon.c @@ -133,7 +133,7 @@ static int avoid_alias(char *p) { int sl, ndot; - /* + /* * This resurrects the belts and suspenders paranoia check by HPA * done in <435560F7.4080006@zytor.com> thread, now enter_repo() * does not do getcwd() based path canonicalizations. @@ -247,7 +247,7 @@ static char *path_ok(struct interp *itable) int pathlen = strlen(path); /* The validation is done on the paths after enter_repo - * appends optional {.git,.git/.git} and friends, but + * appends optional {.git,.git/.git} and friends, but * it does not use getcwd(). So if your /pub is * a symlink to /mnt/pub, you can whitelist /pub and * do not have to say /mnt/pub. @@ -439,7 +439,7 @@ static void parse_extra_args(struct interp *table, char *extra_args, int buflen) } } -void fill_in_extra_table_entries(struct interp *itable) +static void fill_in_extra_table_entries(struct interp *itable) { char *hp; @@ -562,7 +562,7 @@ static int execute(struct sockaddr *addr) for (i = 0; i < ARRAY_SIZE(daemon_service); i++) { struct daemon_service *s = &(daemon_service[i]); int namelen = strlen(s->name); - if (!(-prefixcmp(line, "git-")) && + if (!prefixcmp(line, "git-") && !strncmp(s->name, line + 4, namelen) && line[namelen + 4] == ' ') { /* @@ -970,8 +970,8 @@ static void store_pid(const char *path) FILE *f = fopen(path, "w"); if (!f) die("cannot open pid file %s: %s", path, strerror(errno)); - fprintf(f, "%d\n", getpid()); - fclose(f); + if (fprintf(f, "%d\n", getpid()) < 0 || fclose(f) != 0) + die("failed to write pid file %s: %s", path, strerror(errno)); } static int serve(char *listen_addr, int listen_port, struct passwd *pass, gid_t gid)