never fail.
goto done;
/* Write log file with user and command details. */
- gettimeofday(&last_time, NULL);
+ if (gettimeofday(&last_time, NULL) == -1)
+ goto done;
write_info_log(pathbuf, len, &details, argv, &last_time);
/* Create the timing and I/O log files. */
* XPG4 specifies that vi's exit value is a function of the
* number of errors during editing (?!?!).
*/
- gettimeofday(×[0], NULL);
+ if (gettimeofday(×[0], NULL) == -1) {
+ sudo_warn(U_("unable to read the clock"));
+ goto done;
+ }
+
if (run_command(editor, av) != -1) {
- gettimeofday(×[1], NULL);
+ if (gettimeofday(×[1], NULL) == -1) {
+ sudo_warn(U_("unable to read the clock"));
+ goto done;
+ }
/*
* Sanity checks.
*/
* Run the editor with the invoking user's creds,
* keeping track of the time spent in the editor.
*/
- gettimeofday(×[0], NULL);
+ if (gettimeofday(×[0], NULL) == -1) {
+ sudo_warn(U_("unable to read the clock"));
+ goto cleanup;
+ }
memcpy(&saved_command_details, command_details, sizeof(struct command_details));
command_details->uid = user_details.uid;
command_details->euid = user_details.uid;
command_details->groups = user_details.groups;
command_details->argv = nargv;
rval = run_command(command_details);
- gettimeofday(×[1], NULL);
+ if (gettimeofday(×[1], NULL) == -1) {
+ sudo_warn(U_("unable to read the clock"));
+ goto cleanup;
+ }
/* Restore saved command_details. */
command_details->uid = saved_command_details.uid;
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;
}