Don't dump core from the time(1) process itself

if the child process has exited on a signal
whose default action is to dump core.
This commit is contained in:
Yaroslav Tykhiy 2003-10-04 14:42:03 +00:00
parent 1de1f935f2
commit 1530954057
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120744

View File

@ -73,6 +73,7 @@ main(int argc, char **argv)
int pid;
int aflag, ch, hflag, lflag, status, pflag;
struct timeval before, after;
struct rlimit rl;
struct rusage ru;
FILE *out = stderr;
char *ofn = NULL;
@ -214,8 +215,12 @@ main(int argc, char **argv)
if (exitonsig) {
if (signal(exitonsig, SIG_DFL) == SIG_ERR)
perror("signal");
else
else {
rl.rlim_max = rl.rlim_cur = 0;
if (setrlimit(RLIMIT_CORE, &rl) == -1)
warn("setrlimit");
kill(getpid(), exitonsig);
}
}
exit (WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE);
}