chiark / gitweb /
sd-journal: check if the pointers passed are the same
[elogind.git] / src / journal / sd-journal.c
index c21712b7c47abf6f0c8893b4753b61de17e7220e..779af62b518bff9eb6831a1c64233dcb2b00c01d 100644 (file)
@@ -2217,6 +2217,8 @@ _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from,
                 return -EINVAL;
         if (!from && !to)
                 return -EINVAL;
+        if (from == to)
+                return -EINVAL;
 
         HASHMAP_FOREACH(f, j->files, i) {
                 usec_t fr, t;
@@ -2256,6 +2258,8 @@ _public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot
                 return -EINVAL;
         if (!from && !to)
                 return -EINVAL;
+        if (from == to)
+                return -EINVAL;
 
         HASHMAP_FOREACH(f, j->files, i) {
                 usec_t fr, t;