summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2020-08-21 17:10:50 +0100
committerAlexander Larsson <alexander.larsson@gmail.com>2020-08-24 08:58:08 +0200
commit9bec8659956b0ceaa315682536640a46548a6d9b (patch)
treeda5999558639f96f3760a388da81e7fa71d12c6e
parent333c746f069aa76193b837fb4ffdfc5348c5f462 (diff)
downloadflatpak-9bec8659956b0ceaa315682536640a46548a6d9b.tar.gz
dir: Fix potential overflow when comparing cache timeouts
Also use a constant to clarify the code a little, although it’s functionally equivalent. Signed-off-by: Philip Withnall <withnall@endlessm.com>
-rw-r--r--common/flatpak-dir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index bc537feb..d47075bf 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -10593,7 +10593,7 @@ flatpak_dir_lookup_cached_summary (FlatpakDir *self,
if (summary)
{
guint64 now = g_get_monotonic_time ();
- if ((now - summary->time) < (1000 * 1000 * (SUMMARY_CACHE_TIMEOUT_SEC)) &&
+ if ((now - summary->time) / G_USEC_PER_SEC < SUMMARY_CACHE_TIMEOUT_SEC &&
strcmp (url, summary->url) == 0)
{
/* g_debug ("Using cached summary for remote %s", name); */