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;
35 if (config_lookup("noexec")) {
37 code = send_object(conn, (char *)&code, INTEGER_T);
38 com_err(whoami, code, "Not allowed to execute");
44 mask = sigblock(sigmask(SIGCHLD));
50 log_priority = log_ERROR;
51 com_err(whoami, errno, ": can't fork to run install script");
52 code = send_object(conn, (char *)&n, INTEGER_T);
57 if (setuid(uid) < 0) {
58 com_err(whoami, errno, "Unable to setuid to %d\n", uid);
62 execlp(str, str, (char *)NULL);
65 log_priority = log_ERROR;
66 com_err(whoami, n, ": %s", str);
67 (void) send_object(conn, (char *)&n, INTEGER_T);
72 } while (n != -1 && n != pid);
75 n = waitb.w_retcode + ERROR_TABLE_BASE_sms;
76 log_priority = log_ERROR;
77 com_err(whoami, n, " child exited with status %d", waitb.w_retcode);
78 code = send_object(conn, (char *)&n, INTEGER_T);