X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/2c41d51395b10a41a93015331e5c10f7174bac8c..3884054be9261b4607f5f3a2d0b79695f65b851f:/pixie.c diff --git a/pixie.c b/pixie.c index 5482798..f2a3b2f 100644 --- a/pixie.c +++ b/pixie.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: pixie.c,v 1.9 2001/02/03 16:06:44 mdw Exp $ + * $Id: pixie.c,v 1.11 2002/01/13 13:43:05 mdw Exp $ * * Passphrase pixie for Catacomb * @@ -30,6 +30,12 @@ /*----- Revision history --------------------------------------------------* * * $Log: pixie.c,v $ + * Revision 1.11 2002/01/13 13:43:05 mdw + * Fix bug in daemon mode. + * + * Revision 1.10 2001/02/21 20:03:54 mdw + * Handle select errors (by bombing out). Cosmetic tweak. + * * Revision 1.9 2001/02/03 16:06:44 mdw * Don't set a handler for @SIGINT@ if it's ignored at startup. Add some * error handling for the @select@ loop. @@ -1104,8 +1110,8 @@ static void c_sline(char *s, void *p) selbuf_destroy(&c_client); } exit(0); - } else - puts(s); + } + puts(s); } /* --- @pix_client@ --- * @@ -1155,8 +1161,10 @@ static void pix_client(struct sockaddr_un *sun, size_t sz, char *argv[]) /* --- And repeat --- */ - for (;;) - sel_select(&sel); + for (;;) { + if (sel_select(&sel)) + die(EXIT_FAILURE, "select error: %s", strerror(errno)); + } } /*----- Main code ---------------------------------------------------------*/ @@ -1438,7 +1446,7 @@ int main(int argc, char *argv[]) chdir("/"); setsid(); - if (fork() >= 0) + if (fork() != 0) _exit(0); }