diff options
author | wollman <wollman@FreeBSD.org> | 2003-07-19 02:53:46 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 2003-07-19 02:53:46 +0000 |
commit | 6a270f249904b4185508b3997f11342f75b69784 (patch) | |
tree | 4cc6057acc09443c5e211e05eb009dd6d2dbf8c4 /lib | |
parent | a84180a7b25cf60907f8afc3db1c7a2bf2e72f43 (diff) | |
download | FreeBSD-src-6a270f249904b4185508b3997f11342f75b69784.zip FreeBSD-src-6a270f249904b4185508b3997f11342f75b69784.tar.gz |
C99 compliance: time() always sets its return value in both places
(if present), even on error.
Pointed out by: Wojtek Lerch, on the Austin Group mailing-list
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/time.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libc/gen/time.c b/lib/libc/gen/time.c index 2154833..4468b01 100644 --- a/lib/libc/gen/time.c +++ b/lib/libc/gen/time.c @@ -45,10 +45,13 @@ time(t) time_t *t; { struct timeval tt; + time_t retval; if (gettimeofday(&tt, (struct timezone *)0) < 0) - return (-1); - if (t) - *t = tt.tv_sec; - return (tt.tv_sec); + retval = -1; + else + retval = tt.tv_sec; + if (t != NULL) + *t = retval; + return (retval); } |