* [PATCH] git-daemon: don't ignore pid-file write failure
@ 2007-05-21 7:58 Jim Meyering
0 siblings, 0 replies; only message in thread
From: Jim Meyering @ 2007-05-21 7:58 UTC (permalink / raw)
To: git
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>
---
daemon.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon.c b/daemon.c
index e74ecac..674e30d 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)
--
1.5.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-05-21 7:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-21 7:58 [PATCH] git-daemon: don't ignore pid-file write failure Jim Meyering
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox