Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
daemon: handle freopen() failure
author
René Scharfe
<rene.scharfe@lsrfire.ath.cx>
Fri, 26 Dec 2008 09:46:25 +0000
(10:46 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Sat, 27 Dec 2008 03:07:56 +0000
(19:07 -0800)
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>
daemon.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
8104ebf
)
diff --git
a/daemon.c
b/daemon.c
index 1cef3098d2bd2fb28e2b670ac26c41eebf37dc78..8c317bed4a3bc4e2e8e5afe301084071789e3362 100644
(file)
--- 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);
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;
if (getpeername(0, peer, &slen))
peer = NULL;