]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: use usec_sub_unsigned() where we can
authorLennart Poettering <lennart@poettering.net>
Thu, 25 Oct 2018 10:30:36 +0000 (12:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 25 Oct 2018 19:42:05 +0000 (21:42 +0200)
src/journal/journal-vacuum.c

index 840fb69ee0202a0ff557af0c8677dbd5784a3c8c..e756bf452b30ed67c171d78f68ff498475f7712b 100644 (file)
@@ -15,6 +15,7 @@
 #include "journal-vacuum.h"
 #include "parse-util.h"
 #include "string-util.h"
+#include "time-util.h"
 #include "util.h"
 #include "xattr-util.h"
 
@@ -140,13 +141,8 @@ int journal_directory_vacuum(
         if (max_use <= 0 && max_retention_usec <= 0 && n_max_files <= 0)
                 return 0;
 
-        if (max_retention_usec > 0) {
-                retention_limit = now(CLOCK_REALTIME);
-                if (retention_limit > max_retention_usec)
-                        retention_limit -= max_retention_usec;
-                else
-                        max_retention_usec = retention_limit = 0;
-        }
+        if (max_retention_usec > 0)
+                retention_limit = usec_sub_unsigned(now(CLOCK_REALTIME), max_retention_usec);
 
         d = opendir(directory);
         if (!d)