X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=postlicyd.c;h=f6f3ccc830b861205d8ffbb4c9a5ceaec63a21b7;hb=628163e5113bd3bcce92dc51395998a2fdd8ad9d;hp=bd887e45a1ba9e6888545de8859f87e62d59c0d5;hpb=79ff3ad0aaa667dc9ce658460632177c8ffcf39e;p=apps%2Fpfixtools.git 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; }