summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2014-05-09 16:33:40 +0200
committerTomas Bzatek <tbzatek@redhat.com>2014-05-15 16:09:14 +0200
commit6d3d5a6605473b203432c6b7dc02b08cbb8e27e4 (patch)
tree48f01402f83c1048b8bfca935e9a468ddb67287f
parentcfcb510792201a551b10b213f4e60f2d302da45e (diff)
downloadopenlmi-providers-6d3d5a6605473b203432c6b7dc02b08cbb8e27e4.tar.gz
openlmi-providers-6d3d5a6605473b203432c6b7dc02b08cbb8e27e4.tar.xz
openlmi-providers-6d3d5a6605473b203432c6b7dc02b08cbb8e27e4.zip
journald: Fix EOF reporting when not advancing next on LMI_JournalMessageLog.GetRecord()
Testing wrong return code when sd_journal_next() was not called as it was not needed. When step_next == FALSE the EOF flag must be never set since the journal EOF case is tested at the beginning of the function and we're not advancing next thus staying on a valid cursor.
-rw-r--r--src/journald/instutil.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/journald/instutil.c b/src/journald/instutil.c
index b2ed0e7..12f63bf 100644
--- a/src/journald/instutil.c
+++ b/src/journald/instutil.c
@@ -656,6 +656,7 @@ journal_iter_get_data(gchar **iter_id, sd_journal *journal, gboolean step_next)
return NULL;
}
+ eof_set = FALSE;
if (step_next) {
r = sd_journal_next(journal);
if (r < 0) {
@@ -663,9 +664,10 @@ journal_iter_get_data(gchar **iter_id, sd_journal *journal, gboolean step_next)
g_free(d);
return NULL;
}
+ eof_set = (r == 0);
}
- if (! update_iter(iter_id, r == 0, journal)) {
+ if (! update_iter(iter_id, eof_set, journal)) {
lmi_error("Error getting record message\n");
return NULL;
}