mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 01:49:11 +00:00
Format T_TIMESPEC as "%d.%d" instead of "%.1f"
This fixes the display of the timeout values in the "sudo -V" output on systems without a C99-compliant snprintf(). The snprintf() replacement sudo ships with does not support floating point.
This commit is contained in:
parent
7c121ff834
commit
01b1410d61
@ -191,11 +191,11 @@ struct sudo_defs_types sudo_defs_table[] = {
|
|||||||
NULL,
|
NULL,
|
||||||
}, {
|
}, {
|
||||||
"timestamp_timeout", T_TIMESPEC|T_BOOL,
|
"timestamp_timeout", T_TIMESPEC|T_BOOL,
|
||||||
N_("Authentication timestamp timeout: %.1f minutes"),
|
N_("Authentication timestamp timeout: %d.%d minutes"),
|
||||||
NULL,
|
NULL,
|
||||||
}, {
|
}, {
|
||||||
"passwd_timeout", T_TIMESPEC|T_BOOL,
|
"passwd_timeout", T_TIMESPEC|T_BOOL,
|
||||||
N_("Password prompt timeout: %.1f minutes"),
|
N_("Password prompt timeout: %d.%d minutes"),
|
||||||
NULL,
|
NULL,
|
||||||
}, {
|
}, {
|
||||||
"passwd_tries", T_UINT,
|
"passwd_tries", T_UINT,
|
||||||
|
@ -115,10 +115,10 @@ loglinelen
|
|||||||
"Length at which to wrap log file lines (0 for no wrap): %u"
|
"Length at which to wrap log file lines (0 for no wrap): %u"
|
||||||
timestamp_timeout
|
timestamp_timeout
|
||||||
T_TIMESPEC|T_BOOL
|
T_TIMESPEC|T_BOOL
|
||||||
"Authentication timestamp timeout: %.1f minutes"
|
"Authentication timestamp timeout: %d.%d minutes"
|
||||||
passwd_timeout
|
passwd_timeout
|
||||||
T_TIMESPEC|T_BOOL
|
T_TIMESPEC|T_BOOL
|
||||||
"Password prompt timeout: %.1f minutes"
|
"Password prompt timeout: %d.%d minutes"
|
||||||
passwd_tries
|
passwd_tries
|
||||||
T_UINT
|
T_UINT
|
||||||
"Number of tries to enter a password: %u"
|
"Number of tries to enter a password: %u"
|
||||||
|
@ -130,10 +130,12 @@ dump_defaults(void)
|
|||||||
sudo_printf(SUDO_CONV_INFO_MSG, "\n");
|
sudo_printf(SUDO_CONV_INFO_MSG, "\n");
|
||||||
break;
|
break;
|
||||||
case T_TIMESPEC: {
|
case T_TIMESPEC: {
|
||||||
/* display timespec in minutes as a double */
|
/* display timespec in minutes and 10ths of a minute */
|
||||||
double d = (double)cur->sd_un.tspec.tv_sec +
|
const int min = cur->sd_un.tspec.tv_sec / 60;
|
||||||
((double)cur->sd_un.tspec.tv_nsec / 1000000000.0);
|
int decimin =
|
||||||
sudo_printf(SUDO_CONV_INFO_MSG, desc, d / 60.0);
|
(((cur->sd_un.tspec.tv_sec % 60) * 10) + 30) / 60;
|
||||||
|
decimin += cur->sd_un.tspec.tv_nsec / 100000000;
|
||||||
|
sudo_printf(SUDO_CONV_INFO_MSG, desc, min, decimin);
|
||||||
sudo_printf(SUDO_CONV_INFO_MSG, "\n");
|
sudo_printf(SUDO_CONV_INFO_MSG, "\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user