diff options
author | David King <davidk@gnome.org> | 2013-10-23 18:13:03 +0100 |
---|---|---|
committer | David King <davidk@gnome.org> | 2013-10-24 09:30:19 +0100 |
commit | 0325f69e86d9bcb8790624c109f6da9bb23a75f6 (patch) | |
tree | e045b003a22ddf0a79a25b4d12a459133bfe246a /src/gl-journal.c | |
parent | b79f02b78bbb5bd34e292d9613e92ac0f4b95e76 (diff) | |
download | gnome-logs-0325f69e86d9bcb8790624c109f6da9bb23a75f6.tar.gz |
Set a GError when calling gl_journal_get_data()
Diffstat (limited to 'src/gl-journal.c')
-rw-r--r-- | src/gl-journal.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/gl-journal.c b/src/gl-journal.c index eb2d9b6..998440e 100644 --- a/src/gl-journal.c +++ b/src/gl-journal.c @@ -174,6 +174,7 @@ _gl_journal_query_result (GlJournal *self) GlJournalResult *result; gint ret; sd_journal *journal; + GError *error = NULL; gchar *priority; priv = gl_journal_get_instance_private (self); @@ -230,15 +231,50 @@ _gl_journal_query_result (GlJournal *self) goto out; } - /* FIXME: Pass in a GError and check the result. */ - result->comm = gl_journal_get_data (self, "_COMM", NULL); - result->kernel_device = gl_journal_get_data (self, "_KERNEL_DEVICE", NULL); - result->audit_session = gl_journal_get_data (self, "_AUDIT_SESSION", NULL); result->message = gl_journal_get_data (self, "MESSAGE", NULL); + + if (error != NULL) + { + g_warning ("%s", error->message); + g_clear_error (&error); + free (result->cursor); + free (result->catalog); + goto out; + } + priority = gl_journal_get_data (self, "PRIORITY", NULL); + + if (error != NULL) + { + g_warning ("%s", error->message); + g_clear_error (&error); + free (result->cursor); + free (result->catalog); + g_free (result->message); + goto out; + } + result->priority = atoi (priority); g_free (priority); + result->comm = gl_journal_get_data (self, "_COMM", &error); + + if (error != NULL) + { + g_debug ("%s", error->message); + g_clear_error (&error); + } + + result->kernel_device = gl_journal_get_data (self, "_KERNEL_DEVICE", NULL); + + if (error != NULL) + { + g_debug ("%s", error->message); + g_clear_error (&error); + } + + result->audit_session = gl_journal_get_data (self, "_AUDIT_SESSION", NULL); + return result; out: |