Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2008-12-26 12:46:25 +0300
committerJunio C Hamano <gitster@pobox.com>2008-12-27 06:07:56 +0300
commitc569b1fee151e467854ca268997f4f3baaf73564 (patch)
tree3790486e3c820cf637e2bd31ac889f579d3dbc07 /daemon.c
parent8104ebfe8276657ee803cca7eb8665a78cf3ef83 (diff)
daemon: handle freopen() failure
Die if stderr couldn't be sent to /dev/null when operating in inetd mode and report the error message from the OS. This fixes a compiler warning about the return value of freopen() being ignored on Ubuntu 8.10. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/daemon.c b/daemon.c
index 1cef3098d2..8c317bed4a 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1118,7 +1118,9 @@ int main(int argc, char **argv)
struct sockaddr *peer = (struct sockaddr *)&ss;
socklen_t slen = sizeof(ss);
- freopen("/dev/null", "w", stderr);
+ if (!freopen("/dev/null", "w", stderr))
+ die("failed to redirect stderr to /dev/null: %s",
+ strerror(errno));
if (getpeername(0, peer, &slen))
peer = NULL;