int rdpipe[2];
extern int errno;
-void cleanup()
+cleanup()
{
int stat, serrno = errno;
char buf[BUFSIZ];
WEXITSTATUS(stat));
}
if (WIFSIGNALED(stat)) {
- sprintf(buf, "exited with signal %d%s\n",
+ sprintf(buf, "exited on signal %d%s\n",
WTERMSIG(stat),
(WCOREDUMP(stat)?"; Core dumped":0));
}
struct sigaction action;
int nfds;
-
+
getrlimit(RLIMIT_NOFILE, &rl);
nfds = rl.rlim_cur;
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
sigaction(SIGCHLD, &action, NULL);
-
+
sprintf(buf, "%s/%s.log", SMS_DIR, PROG);
logf = open(buf, O_CREAT|O_WRONLY|O_APPEND, 0640);
if (logf<0) {
done = 0;
errno = 0;
if (fgets(buf, BUFSIZ, prog) == NULL) {
- if (errno) {
+ if (errno && errno!=EINTR) {
strcpy(buf, "Unable to read from program: ");
strcat(buf, sys_errlist[errno]);
strcat(buf, "\n");
} while (!done);
exit(0);
}
-
-
-
-
#include <sys/signal.h>
#include <sys/ioctl.h>
#include <fcntl.h>
-#include <sys/stat.h>
#include <sys/resource.h>
#include <moira_site.h>
#define PROG "reg_svr"
int rdpipe[2];
+extern int errno;
cleanup()
{
- int stat;
+ int stat, serrno = errno;
char buf[BUFSIZ];
- extern int errno;
- int serrno = errno;
buf[0]='\0';
done = 0;
errno = 0;
if (fgets(buf, BUFSIZ, prog) == NULL) {
- if (errno) {
+ if (errno && errno!=EINTR) {
strcpy(buf, "Unable to read from program: ");
strcat(buf, sys_errlist[errno]);
strcat(buf, "\n");
} while (!done);
exit(0);
}
-
-
-
-
#include <sys/wait.h>
#include <sys/signal.h>
#include <sys/ioctl.h>
-#include <moira_site.h>
-#include <sys/stat.h>
-#include <sys/resource.h>
#include <fcntl.h>
+#include <sys/resource.h>
+#include <moira_site.h>
#define PROG "moirad"
int rdpipe[2];
+extern int errno;
char *whoami;
cleanup()
{
- int stat;
-
+ int stat, serrno = errno;
char buf[BUFSIZ];
- extern int errno;
- int serrno = errno;
buf[0]='\0';
struct sigaction action;
int nfds;
-
+
whoami = argv[0];
-
+
getrlimit(RLIMIT_NOFILE, &rl);
nfds = rl.rlim_cur;
done = 0;
errno = 0;
if (fgets(buf, BUFSIZ, prog) == NULL) {
- if (errno) {
+ if (errno && errno!=EINTR) {
strcpy(buf, "Unable to read from program: ");
strcat(buf, sys_errlist[errno]);
strcat(buf, "\n");
} while (!done);
exit(0);
}
-
-
-
-