diff options
author | yar <yar@FreeBSD.org> | 2003-10-04 14:42:03 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2003-10-04 14:42:03 +0000 |
commit | 8d8c161949a18e5115672ef93b1cb009d8d4b003 (patch) | |
tree | 62acfa5d7684e2fda11607e983419468429b1f9a /usr.bin | |
parent | c1590e86660a9c3839bde7b4b0583f6e2fe163c0 (diff) | |
download | FreeBSD-src-8d8c161949a18e5115672ef93b1cb009d8d4b003.zip FreeBSD-src-8d8c161949a18e5115672ef93b1cb009d8d4b003.tar.gz |
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.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/time/time.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c index c7a2486..15f1cb7 100644 --- a/usr.bin/time/time.c +++ b/usr.bin/time/time.c @@ -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); } |