From 7858f37800f01acdad0a3f718bd37a92fdd54377 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 15 Feb 2017 13:27:33 +0100 Subject: [PATCH] Fix for CID 1402403 --- src/induct.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/induct.c b/src/induct.c index a5f7db9b4..1b8889b85 100644 --- a/src/induct.c +++ b/src/induct.c @@ -16,8 +16,14 @@ static int sort_by_mtime (const void *p1, const void *p2) const char **f1 = (const char **) p1; const char **f2 = (const char **) p2; - hc_stat_t s1; hc_stat (*f1, &s1); - hc_stat_t s2; hc_stat (*f2, &s2); + hc_stat_t s1; + hc_stat_t s2; + + const int rc1 = hc_stat (*f1, &s1); + const int rc2 = hc_stat (*f2, &s2); + + if (rc1 < rc2) return 1; + if (rc1 > rc2) return -1; return s2.st_mtime - s1.st_mtime; }