lib: Initialise uptime variables

upminutes and uphours could both not get initialised in the
procps_uptime_sprint_short() function.

Error was probably introduced at the referenced commit.

References:
 Coverity 240787 Uninitialized scalar variable
 Coverity 240776 Uninitialized scalar variable
 commit 0496b39876

Signed-off-by: Craig Small <csmall@dropbear.xyz>
This commit is contained in:
Craig Small 2021-11-02 17:23:37 +11:00
parent 2e0e865ca5
commit 10824b0655

View File

@ -151,7 +151,7 @@ PROCPS_EXPORT char *procps_uptime_sprint(void)
*/
PROCPS_EXPORT char *procps_uptime_sprint_short(void)
{
int updecades, upyears, upweeks, updays, uphours, upminutes;
int updecades, upyears, upweeks, updays, uphours, upminutes = 0;
int pos = 3;
int comma = 0;
double uptime_secs, idle_secs;