]> andersk Git - moira.git/commitdiff
solaris port
authormar <mar>
Mon, 24 May 1993 15:11:55 +0000 (15:11 +0000)
committermar <mar>
Mon, 24 May 1993 15:11:55 +0000 (15:11 +0000)
update/exec_002.c
update/log.c

index eea177351fc43a08e4f4ac2363096fedd537292e..672a03936015dc56ea89cf012003596d16e266d0 100644 (file)
@@ -33,12 +33,14 @@ int
 exec_002(str)
     char *str;
 {
-#ifdef _AIX
+#ifdef POSIX
     int waitb;
+    sigset_t mask,oldmask;
 #else
     union wait waitb;
+    int mask;
 #endif
-    int n, pid, mask;
+    int n, pid;
 
     if (config_lookup("noexec")) {
        code = EPERM;
@@ -49,12 +51,22 @@ exec_002(str)
     str += 8;
     while (*str == ' ')
        str++;
+#ifdef POSIX
+    sigemptyset(&mask);
+    sigaddset(&mask,SIGCHLD);
+    sigprocmask(SIG_BLOCK,&mask,&oldmask);
+#else
     mask = sigblock(sigmask(SIGCHLD));
+#endif
     pid = fork();
     switch (pid) {
     case -1:
        n = errno;
+#ifdef POSIX
+       sigprocmask(SIG_UNBLOCK,&oldmask,&mask);
+#else
        sigsetmask(mask);
+#endif
        log_priority = log_ERROR;
        com_err(whoami, errno, ": can't fork to run install script");
        code = send_object(conn, (char *)&n, INTEGER_T);
@@ -66,10 +78,18 @@ exec_002(str)
            com_err(whoami, errno, "Unable to setuid to %d\n", uid);
            exit(1);
        }
+#ifdef POSIX
+       sigprocmask(SIG_UNBLOCK,&oldmask,&mask);
+#else
        sigsetmask(mask);
+#endif
        execlp(str, str, (char *)NULL);
        n = errno;
+#ifdef POSIX
+       sigprocmask(SIG_UNBLOCK,&oldmask,&mask);
+#else
        sigsetmask(mask);
+#endif
        log_priority = log_ERROR;
        com_err(whoami, n, ": %s", str);
        (void) send_object(conn, (char *)&n, INTEGER_T);
@@ -78,12 +98,24 @@ exec_002(str)
        do {
            n = wait(&waitb);
        } while (n != -1 && n != pid);
+#ifdef POSIX
+       sigprocmask(SIG_UNBLOCK,&oldmask,&mask);
+#else
        sigsetmask(mask);
-       if (WEXITSTATUS(waitb)) {
+#endif
+#ifdef POSIX
+       if (WIFEXITED(waitb)) {
            n = WEXITSTATUS(waitb) + ERROR_TABLE_BASE_sms;
            log_priority = log_ERROR;
            com_err(whoami, n, " child exited with status %d",
                    WEXITSTATUS(waitb));
+#else
+       if (waitb.w_status) {
+           n = waitb.w_retcode + ERROR_TABLE_BASE_sms;
+           log_priority = log_ERROR;
+           com_err(whoami, n, " child exited with status %d",
+                   waitb.w_retcode);
+#endif
            code = send_object(conn, (char *)&n, INTEGER_T);
            if (code) {
                exit(1);
index 8edb2cac7cdd2dc694063f7b7f42323f2eb714f8..415280e960f4871cd548fc42bb7f8123623beae5 100644 (file)
@@ -24,9 +24,6 @@ static char *rcsid_log_c = "$Header$";
 #include <mit-copyright.h>
 #include <stdio.h>
 #include "com_err.h"
-#ifdef sun
-#undef sparc /* varargs.h depends on sparc, which we use differently */
-#endif /* sun */
 #include <varargs.h>
 #include "update.h"
 #include <krb.h>
This page took 0.141887 seconds and 5 git commands to generate.