From b7403080f0266ac41cecae80adcfa0391f3f93b7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 15 Feb 2013 02:43:51 +0000 Subject: avoid racy sleep on fork failure in master process We need to atomically enable interrupts and sleep with the same syscall. Fortunately, using pselect (through mog_sleep) allows that and is POSIX-compliant, so use that. --- cmogstored.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmogstored.c b/cmogstored.c index adad681..3c389bc 100644 --- a/cmogstored.c +++ b/cmogstored.c @@ -468,9 +468,7 @@ static void fork_worker(unsigned worker_id) exit(EXIT_SUCCESS); } else { syslog(LOG_ERR, "fork() failed: %m, sleeping for 10s"); - mog_intr_enable(); - sleep(10); - mog_intr_disable(); + mog_sleep(10); } } -- cgit v1.2.3-24-ge0c7