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>
This commit is contained in:
parent
5b6dedd6a0
commit
bc4e7d0358
4
daemon.c
4
daemon.c
@ -970,8 +970,8 @@ static void store_pid(const char *path)
|
|||||||
FILE *f = fopen(path, "w");
|
FILE *f = fopen(path, "w");
|
||||||
if (!f)
|
if (!f)
|
||||||
die("cannot open pid file %s: %s", path, strerror(errno));
|
die("cannot open pid file %s: %s", path, strerror(errno));
|
||||||
fprintf(f, "%d\n", getpid());
|
if (fprintf(f, "%d\n", getpid()) < 0 || fclose(f) != 0)
|
||||||
fclose(f);
|
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)
|
static int serve(char *listen_addr, int listen_port, struct passwd *pass, gid_t gid)
|
||||||
|
Loading…
Reference in New Issue
Block a user