Check the return value of gettimeofday(), even though it should

never fail.
This commit is contained in:
Todd C. Miller
2015-02-25 07:10:25 -07:00
parent 5d2e9426b2
commit 973286c7ac
4 changed files with 24 additions and 10 deletions

View File

@@ -126,14 +126,14 @@ utmp_settime(sudo_utmp_t *ut)
struct timeval tv;
debug_decl(utmp_settime, SUDO_DEBUG_UTMP)
gettimeofday(&tv, NULL);
if (gettimeofday(&tv, NULL) == 0) {
#if defined(HAVE_STRUCT_UTMP_UT_TV) || defined(HAVE_STRUCT_UTMPX_UT_TV)
ut->ut_tv.tv_sec = tv.tv_sec;
ut->ut_tv.tv_usec = tv.tv_usec;
ut->ut_tv.tv_sec = tv.tv_sec;
ut->ut_tv.tv_usec = tv.tv_usec;
#else
ut->ut_time = tv.tv_sec;
ut->ut_time = tv.tv_sec;
#endif
}
debug_return;
}