]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: save correct location specifier
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 21 May 2023 16:59:18 +0000 (01:59 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 21 May 2023 17:54:40 +0000 (02:54 +0900)
src/libsystemd/sd-journal/sd-journal.c

index d4adbe5f0f467ff683f15d5e07b7e2719248897f..bc587319b82990ced4c73cb795d72efaca383fcd 100644 (file)
@@ -812,7 +812,8 @@ static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc
 
         /* If we hit EOF before, we don't need to look into this file again
          * unless direction changed or new entries appeared. */
-        if (f->last_direction == direction && f->location_type == LOCATION_TAIL &&
+        if (f->last_direction == direction &&
+            f->location_type == (direction == DIRECTION_DOWN ? LOCATION_TAIL : LOCATION_HEAD) &&
             n_entries == f->last_n_entries)
                 return 0;
 
@@ -940,7 +941,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) {
                         remove_file_real(j, f);
                         continue;
                 } else if (r == 0) {
-                        f->location_type = LOCATION_TAIL;
+                        f->location_type = direction == DIRECTION_DOWN ? LOCATION_TAIL : LOCATION_HEAD;
                         continue;
                 }