X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=daemon.c;h=674e30dca3d05cabc5a72e7bb0a40e64eaa4b2eb;hb=9cb18f56fdee6885884f5f08bd5335a42d9034dc;hp=e74ecac952fa0d399a1ed0c426a9e27d96b3ddcb;hpb=c379c4b176ce350a8d6c0773a3ad211996d809db;p=git.git diff --git a/daemon.c b/daemon.c index e74ecac95..674e30dca 100644 --- a/daemon.c +++ b/daemon.c @@ -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)