Skip to content

Commit

Permalink
Merge branch '4613_check_eta_overflow'
Browse files Browse the repository at this point in the history
* 4613_check_eta_overflow:
  Ticket #4613: check for ETA overflow.
  • Loading branch information
aborodin committed Dec 14, 2024
2 parents 7fc6dfc + 27c01b8 commit 7950ae8
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/filemanager/filegui.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

#include <errno.h>
#include <ctype.h>
#include <limits.h> /* INT_MAX */
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
Expand Down Expand Up @@ -347,18 +348,27 @@ file_eta_prepare_for_show (char *buffer, double eta_secs, gboolean always_show)
{
char _fmt_buff[BUF_TINY];

if (eta_secs <= 0.5)
if (eta_secs >= INT_MAX)
{
if (!always_show)
/* Over 68 years */
g_strlcpy (_fmt_buff, "--", sizeof (_fmt_buff));
}
else
{
if (eta_secs <= 0.5)
{
*buffer = '\0';
return;
if (!always_show)
{
*buffer = '\0';
return;
}

eta_secs = 1.0;
}

eta_secs = 1.0;
file_frmt_time (_fmt_buff, eta_secs);
}

file_frmt_time (_fmt_buff, eta_secs);
g_snprintf (buffer, BUF_TINY, _("ETA %s"), _fmt_buff);
}

Expand Down

0 comments on commit 7950ae8

Please sign in to comment.