From 628163e5113bd3bcce92dc51395998a2fdd8ad9d Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Fri, 24 Aug 2007 00:17:06 +0200 Subject: [PATCH] refactor Signed-off-by: Pierre Habouzit --- postlicyd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/postlicyd.c b/postlicyd.c index bd887e4..f6f3ccc 100644 --- a/postlicyd.c +++ b/postlicyd.c @@ -89,8 +89,10 @@ void *job_run(void *_fd) static void main_loop(void) { + int sock = -1; + while (!sigint) { - int fd = accept(-1, NULL, 0); + int fd = accept(sock, NULL, 0); pthread_attr_t attr; pthread_t dummy; @@ -105,6 +107,9 @@ static void main_loop(void) pthread_create(&dummy, &attr, job_run, (void *)(intptr_t)fd); pthread_attr_destroy(&attr); } + + cleanexit = true; + close(sock); } static void main_shutdown(void) @@ -122,7 +127,6 @@ int main(void) main_initialize(); main_loop(); - cleanexit = true; main_shutdown(); return EXIT_SUCCESS; } -- 2.20.1