summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2001-04-05 20:55:17 +0000
committerEric Andersen2001-04-05 20:55:17 +0000
commitea9065072c91b6397cb3cb597f248d23415169f0 (patch)
tree443da5367b2e6197a4412eb2eff56e269ce33338
parent79359d87e86963607ea11dddd9b18cb43896b765 (diff)
downloadbusybox-ea9065072c91b6397cb3cb597f248d23415169f0.zip
busybox-ea9065072c91b6397cb3cb597f248d23415169f0.tar.gz
Some cleanups/fixes for the syslogd circular buffer code
from Gennady Feldman.
-rw-r--r--sysklogd/syslogd.c16
-rw-r--r--syslogd.c16
2 files changed, 18 insertions, 14 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index e83ce48..6aec78b 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -119,7 +119,7 @@ static inline void sem_up(int semid)
*/
static inline void sem_down(int semid)
{
- if ( semop(semid, SMwdn, 2) == -1 )
+ if ( semop(semid, SMwdn, 3) == -1 )
perror_msg_and_die("semop[SMwdn]");
}
@@ -155,6 +155,8 @@ void ipcsyslog_init(void){
perror_msg_and_die("semget");
}else
perror_msg_and_die("semget");
+ } else {
+ sem_up(s_semid);
}
}else{
printf("Buffer already allocated just grab the semaphore?");
@@ -514,6 +516,12 @@ static void doSyslogd (void)
FD_ZERO (&fds);
FD_SET (sock_fd, &fds);
+#ifdef BB_FEATURE_IPC_SYSLOG
+ if (circular_logging == TRUE ){
+ ipcsyslog_init();
+ }
+#endif
+
#ifdef BB_FEATURE_REMOTE_LOG
if (doRemoteLog == TRUE){
init_RemoteLog();
@@ -619,12 +627,6 @@ extern int syslogd_main(int argc, char **argv)
umask(0);
-#ifdef BB_FEATURE_IPC_SYSLOG
- if (circular_logging == TRUE ){
- ipcsyslog_init();
- }
-#endif
-
if (doFork == TRUE) {
if (daemon(0, 1) < 0)
perror_msg_and_die("daemon");
diff --git a/syslogd.c b/syslogd.c
index e83ce48..6aec78b 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -119,7 +119,7 @@ static inline void sem_up(int semid)
*/
static inline void sem_down(int semid)
{
- if ( semop(semid, SMwdn, 2) == -1 )
+ if ( semop(semid, SMwdn, 3) == -1 )
perror_msg_and_die("semop[SMwdn]");
}
@@ -155,6 +155,8 @@ void ipcsyslog_init(void){
perror_msg_and_die("semget");
}else
perror_msg_and_die("semget");
+ } else {
+ sem_up(s_semid);
}
}else{
printf("Buffer already allocated just grab the semaphore?");
@@ -514,6 +516,12 @@ static void doSyslogd (void)
FD_ZERO (&fds);
FD_SET (sock_fd, &fds);
+#ifdef BB_FEATURE_IPC_SYSLOG
+ if (circular_logging == TRUE ){
+ ipcsyslog_init();
+ }
+#endif
+
#ifdef BB_FEATURE_REMOTE_LOG
if (doRemoteLog == TRUE){
init_RemoteLog();
@@ -619,12 +627,6 @@ extern int syslogd_main(int argc, char **argv)
umask(0);
-#ifdef BB_FEATURE_IPC_SYSLOG
- if (circular_logging == TRUE ){
- ipcsyslog_init();
- }
-#endif
-
if (doFork == TRUE) {
if (daemon(0, 1) < 0)
perror_msg_and_die("daemon");