summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPeng Haitao <penght@cn.fujitsu.com>2012-01-06 14:48:18 +0800
committerRainer Gerhards <rgerhards@adiscon.com>2012-01-16 17:12:57 +0100
commit167192666ba8905b83210ab7c5f00cc6be9f7147 (patch)
treef28363e378827fe12c6b9f712f2023b83366ecaa /tools
parentabb381b8a5861be1d065afea85f355f478d87e5d (diff)
downloadrsyslog-167192666ba8905b83210ab7c5f00cc6be9f7147.tar.gz
rsyslog-167192666ba8905b83210ab7c5f00cc6be9f7147.tar.xz
rsyslog-167192666ba8905b83210ab7c5f00cc6be9f7147.zip
fix error of not define HAVE_SETSID
[add list to the CC list] When HAVE_SETSID is not defined, rsyslogd will use ioctl() make itself to daemon, but this can not make rsyslogd process become the process group leader of a new process group. In RHEL6.1, the status is as follows: # uname -a Linux RHEL6U1GA-Intel64-199 2.6.32-131.0.15.el6.x86_64 #1 SMP Tue May 10 15:42:40 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux # /etc/init.d/rsyslog restart Shutting down system logger: [ OK ] Starting system logger: [ OK ] # ps axo pgrp,ppid,pid,comm | grep rsyslog 6290 1 6301 rsyslogd When we send SIGTERM signal to 6290, rsyslogd will die:( So I think we should call setpgid() before ioctl(). Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/syslogd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 6879bafa..65770404 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -460,8 +460,15 @@ void untty(void)
#else
{
int i;
+ pid_t pid;
if(!Debug) {
+ pid = getpid();
+ if (setpgid(pid, pid) < 0) {
+ perror("setpgid");
+ exit(1);
+ }
+
i = open(_PATH_TTY, O_RDWR|O_CLOEXEC);
if (i >= 0) {
# if !defined(__hpux)