[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-cvs
Subject:    [IPCop-cvs] ipcop/src/misc-progs restartsyslogd.c,1.2.2.4,1.2.2.5
From:       Olaf Westrik <owes () users ! sourceforge ! net>
Date:       2009-09-12 15:27:37
Message-ID: E1MmUVl-00060C-EC () 23jxhf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/ipcop/ipcop/src/misc-progs
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv22992/src/misc-progs

Modified Files:
      Tag: IPCOP_v1_4_0
	restartsyslogd.c 
Log Message:
Fix restartsyslogd for remote logging.
syslogd needs to be killed and started to be able to start remote logging.


Index: restartsyslogd.c
===================================================================
RCS file: /cvsroot/ipcop/ipcop/src/misc-progs/restartsyslogd.c,v
retrieving revision 1.2.2.4
retrieving revision 1.2.2.5
diff -C2 -d -r1.2.2.4 -r1.2.2.5
*** restartsyslogd.c	11 Jun 2006 21:27:32 -0000	1.2.2.4
--- restartsyslogd.c	12 Sep 2009 15:27:35 -0000	1.2.2.5
***************
*** 32,35 ****
--- 32,36 ----
     char buffer[STRING_SIZE], hostname[STRING_SIZE];
     int config_fd,rc,fd,pid;
+    int remote_log = 0;
     struct stat st;
     struct keyvalue *kv = NULL;
***************
*** 55,58 ****
--- 56,60 ----
        exit(ERR_SETTINGS);
     }
+    remote_log = (strcmp(buffer,"on") == 0);
  
     if (!findkey(kv, "REMOTELOG_ADDR", hostname))
***************
*** 99,103 ****
     }
  
!    if (!strcmp(buffer,"on"))
        snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e \
's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@\\).\\+$/\\1%s/' /etc/syslog.conf >&%d", hostname, \
config_fd );  else
--- 101,105 ----
     }
  
!    if (remote_log)
        snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e \
's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@\\).\\+$/\\1%s/' /etc/syslog.conf >&%d", hostname, \
config_fd );  else
***************
*** 120,124 ****
     }
  
! 
     /* Get syslogd to read the new config file */
     if ((fd = open("/var/run/syslogd.pid", O_RDONLY)) == -1)
--- 122,132 ----
     }
  
!    /* If remote syslog is used, stop syslogd first as syslogd will not be able to \
                open udp/514 as non-root */
!    if ((access("/var/run/syslogd.pid", 0) != -1) && remote_log)
!    {
!       safe_system("/bin/killall syslogd");
!       unlink("/var/run/syslogd.pid");
!    }
!     
     /* Get syslogd to read the new config file */
     if ((fd = open("/var/run/syslogd.pid", O_RDONLY)) == -1)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
IPCop-cvs mailing list
IPCop-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic