5 /* (c) Copyright 1988 by the Massachusetts Institute of Technology. */
6 /* For copying and distribution information, please see the file */
7 /* <mit-copyright.h>. */
10 static char *rcsid_exec_002_c = "$Header$";
13 #include <mit-copyright.h>
16 #include <sys/types.h>
23 extern CONNECTION conn;
24 extern int code, errno, uid;
27 #if defined(vax) || defined(ibm032)
28 #define WEXITSTATUS(waitb) ((waitb).w_retcode)
43 if (config_lookup("noexec")) {
45 code = send_object(conn, (char *)&code, INTEGER_T);
46 com_err(whoami, code, "Not allowed to execute");
52 mask = sigblock(sigmask(SIGCHLD));
58 log_priority = log_ERROR;
59 com_err(whoami, errno, ": can't fork to run install script");
60 code = send_object(conn, (char *)&n, INTEGER_T);
65 if (setuid(uid) < 0) {
66 com_err(whoami, errno, "Unable to setuid to %d\n", uid);
70 execlp(str, str, (char *)NULL);
73 log_priority = log_ERROR;
74 com_err(whoami, n, ": %s", str);
75 (void) send_object(conn, (char *)&n, INTEGER_T);
80 } while (n != -1 && n != pid);
82 if (WEXITSTATUS(waitb)) {
83 n = WEXITSTATUS(waitb) + ERROR_TABLE_BASE_sms;
84 log_priority = log_ERROR;
85 com_err(whoami, n, " child exited with status %d",
87 code = send_object(conn, (char *)&n, INTEGER_T);