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
This commit is contained in:
wollman 2003-07-19 02:53:46 +00:00
parent a84180a7b2
commit 6a270f2499

View File

@ -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);
}