]> git.ipfire.org Git - thirdparty/git.git/blobdiff - daemon.c
War on whitespace
[thirdparty/git.git] / daemon.c
index e74ecac952fa0d399a1ed0c426a9e27d96b3ddcb..77792509e3e9e33556555e967a207c487ab5ebf1 100644 (file)
--- 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.
@@ -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)