summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-29 12:40:41 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-29 12:40:41 +0200
commit6511278082a7e1e9602385cd24cdb5e363cb702f (patch)
treeda40eaf59776b92541e2f83b9b6b2465bd3d99c3 /tools
parent736a3631e63955175294311988090e22dac93a8e (diff)
downloadrsyslog-6511278082a7e1e9602385cd24cdb5e363cb702f.tar.gz
rsyslog-6511278082a7e1e9602385cd24cdb5e363cb702f.tar.xz
rsyslog-6511278082a7e1e9602385cd24cdb5e363cb702f.zip
bugfix: ssh session hangs after rsyslgod is started from it
stderr/stdout were not closed to be able to emit error messages, but this caused ssh sessions to hang. Now we close them after the initial initialization. See forum thread: http://kb.monitorware.com/controlling-terminal-issues-t9875.html
Diffstat (limited to 'tools')
-rw-r--r--tools/syslogd.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 77273bec..45c55664 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -3015,7 +3015,6 @@ static rsRetVal mainThread()
glbl.SetHUPisRestart(0); /* we can not do restart-type HUPs with dropped privs */
}
-
/* END OF INTIALIZATION
* ... but keep in mind that we might do a restart and thus init() might
* be called again. If that happens, we must shut down the worker thread,
@@ -3024,6 +3023,19 @@ static rsRetVal mainThread()
*/
dbgprintf("initialization completed, transitioning to regular run mode\n");
+ /* close stderr and stdout if they are kept open during a fork. Note that this
+ * may introduce subtle security issues: if we are in a jail, one may break out of
+ * it via these descriptors. But if I close them earlier, error messages will (once
+ * again) not be emitted to the user that starts the daemon. As root jail support
+ * is still in its infancy (and not really done), we currently accept this issue.
+ * rgerhards, 2009-06-29
+ */
+ if(!(Debug || NoFork)) {
+ close(1);
+ close(2);
+ bErrMsgToStderr = 0;
+ }
+
mainloop();
finalize_it: