summaryrefslogtreecommitdiffstats
path: root/usr.bin/time
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-10-12 18:41:26 +0000
committerjkh <jkh@FreeBSD.org>1996-10-12 18:41:26 +0000
commit8a4edeb5fd52344d93839ba1a6e8d2f857e5fd78 (patch)
treee044547b532fb89942e1247a27044f2cab2d89b8 /usr.bin/time
parentd03a8a45844b319218f8fd6a88fd7c72615f3fe0 (diff)
downloadFreeBSD-src-8a4edeb5fd52344d93839ba1a6e8d2f857e5fd78.zip
FreeBSD-src-8a4edeb5fd52344d93839ba1a6e8d2f857e5fd78.tar.gz
Close PR#1781 - time returns with EXIT_SUCCESS on some failures
Submitted-By: Tor Egge <Tor.Egge@idt.ntnu.no>
Diffstat (limited to 'usr.bin/time')
-rw-r--r--usr.bin/time/time.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c
index e911d8c..96b1607 100644
--- a/usr.bin/time/time.c
+++ b/usr.bin/time/time.c
@@ -46,6 +46,8 @@ static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 6/6/93";
#include <sys/resource.h>
#include <sys/signal.h>
#include <sys/sysctl.h>
+#include <stdlib.h>
+#include <sys/wait.h>
#include <err.h>
#include <stdio.h>
@@ -149,7 +151,7 @@ main(argc, argv)
fprintf(stderr, "%10ld %s\n",
ru.ru_nivcsw, "involuntary context switches");
}
- exit (status>>8);
+ exit (WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE);
}
/*
OpenPOWER on IntegriCloud