We use two processes to avoid spleeping for a long time due to
logging but we have a bug.

This patch converts the main process to use semtimedop instead of
semop since it can't sleep for a long time.

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 usr/log.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/usr/log.c b/usr/log.c
index 4a30f05..c2fce1f 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -235,12 +235,15 @@ static void log_syslog (void * buff)
 
 static void dolog(int prio, const char *fmt, va_list ap)
 {
+       struct timespec t;
+
        if (is_daemon) {
+               t.tv_sec = 1;
+               t.tv_nsec = 0;
+
                la->ops[0].sem_op = -1;
-               if (semop(la->semid, la->ops, 1) < 0) {
-                       syslog(LOG_ERR, "semop up failed");
+               if (semtimedop(la->semid, la->ops, 1, &t) < 0)
                        return;
-               }
 
                log_enqueue(prio, fmt, ap);
 
-- 
1.5.5.GIT

_______________________________________________
Stgt-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/stgt-devel

Reply via email to