chiark / gitweb /
Portability fixes.
[userv.git] / overlord.c
index be2553ae019155adae0a61d32bfb7c0ddfa79636..241bb0de60d00a2d1fc19b85e6cff15cc57e5739 100644 (file)
@@ -19,7 +19,6 @@
  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include <wait.h>
 #include <unistd.h>
 #include <signal.h>
 #include <syslog.h>
@@ -28,6 +27,7 @@
 #include <stdio.h>
 #include <assert.h>
 #include <fnmatch.h>
+#include <sys/wait.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
@@ -94,7 +94,7 @@ static void sighandler_chld(int x) {
             (long)r,status);
     } else if (WEXITSTATUS(status)>12) {
       if (WEXITSTATUS(status)>24)
-       syslog(LOG_ERR,"call pid %ld exited with status %ld >24",
+       syslog(LOG_ERR,"call pid %ld exited with status %d >24",
               (long)r,WEXITSTATUS(status));
       checkstalepipes();
     }
@@ -130,7 +130,7 @@ int main(int argc, char *const *argv) {
   checkstalepipes();
 
   mfd= socket(AF_UNIX,SOCK_STREAM,0);
-  if (!mfd) { syslog(LOG_CRIT,"cannot create master socket: %m"); exit(4); }
+  if (mfd<0) { syslog(LOG_CRIT,"cannot create master socket: %m"); exit(4); }
 
   assert(sizeof(ssockname.sun_path) > sizeof(RENDEZVOUS));
   ssockname.sun_family= AF_UNIX;
@@ -156,7 +156,7 @@ int main(int argc, char *const *argv) {
     if (sfd<0) {
       errno= e;
       if (errno == EINTR) continue;
-      if (errno == ENOMEM) {
+      if (errno == ENOMEM || errno == EPROTO || errno == EAGAIN) {
         syslog(LOG_ERR,"unable to accept connection: %m");
        continue;
       } else {