Skip to content

Commit

Permalink
git-daemon: don't ignore pid-file write failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jim Meyering authored and Junio C Hamano committed May 22, 2007
1 parent 5b6dedd commit bc4e7d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bc4e7d0

Please sign in to comment.