aboutsummaryrefslogtreecommitdiff
path: root/daemon.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-05-21 09:58:01 +0200
committerJunio C Hamano <junkio@cox.net>2007-05-21 18:34:14 -0700
commitbc4e7d035840539eb5aa13ab3d51ab43cc2c1b50 (patch)
tree3463c8d6e1b2560f27ad7ab98746dcf46dca2aae /daemon.c
parent5b6dedd6a0b7566f7e8466b6aefe8f019c52f5d3 (diff)
downloadgit-bc4e7d035840539eb5aa13ab3d51ab43cc2c1b50.tar.gz
git-bc4e7d035840539eb5aa13ab3d51ab43cc2c1b50.tar.xz
git-daemon: don't ignore pid-file write failure
Note: since the consequence of failure is to call die, I don't bother to close "f". Signed-off-by: Jim Meyering <jim@meyering.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c4
1 files changed, 2 insertions, 2 deletions
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)