]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: make journal_file_close() return NULL
authorLennart Poettering <lennart@poettering.net>
Fri, 2 Oct 2015 20:36:33 +0000 (22:36 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 2 Oct 2015 20:36:33 +0000 (22:36 +0200)
The way it is customary everywhere else in our sources.

src/journal/journal-file.c
src/journal/journal-file.h
src/journal/journald-server.c

index 73d3a4bb9d2307f27a6484551fcb420b24c58f4b..960d6bfd8c0cde121546ac3a912779484e943f32 100644 (file)
@@ -128,7 +128,7 @@ int journal_file_set_offline(JournalFile *f) {
         return 0;
 }
 
-void journal_file_close(JournalFile *f) {
+JournalFile* journal_file_close(JournalFile *f) {
         assert(f);
 
 #ifdef HAVE_GCRYPT
@@ -179,6 +179,7 @@ void journal_file_close(JournalFile *f) {
 #endif
 
         free(f);
+        return NULL;
 }
 
 static int journal_file_init_header(JournalFile *f, JournalFile *template) {
index e92b75eabe8ff56bc7b30ceadb9f08b19e2ee50e..52e6b7a261ceebaf78a5feb45e86f634e42a8bab 100644 (file)
@@ -136,7 +136,7 @@ int journal_file_open(
                 JournalFile **ret);
 
 int journal_file_set_offline(JournalFile *f);
-void journal_file_close(JournalFile *j);
+JournalFile* journal_file_close(JournalFile *j);
 
 int journal_file_open_reliably(
                 const char *fname,
index 4566612949d7d59f3b27f250d2e1aec453fc57ac..50e9b08da9219bbf9dab5542b1a345c62376c312 100644 (file)
@@ -1091,11 +1091,12 @@ int server_flush_to_var(Server *s) {
                 }
         }
 
+        r = 0;
+
 finish:
         journal_file_post_change(s->system_journal);
 
-        journal_file_close(s->runtime_journal);
-        s->runtime_journal = NULL;
+        s->runtime_journal = journal_file_close(s->runtime_journal);
 
         if (r >= 0)
                 (void) rm_rf("/run/log/journal", REMOVE_ROOT);
@@ -1340,8 +1341,8 @@ static int server_parse_proc_cmdline(Server *s) {
                 } else if (startswith(word, "systemd.journald"))
                         log_warning("Invalid systemd.journald parameter. Ignoring.");
         }
-        /* do not warn about state here, since probably systemd already did */
 
+        /* do not warn about state here, since probably systemd already did */
         return 0;
 }
 
@@ -1616,11 +1617,7 @@ int server_init(Server *s) {
         server_cache_boot_id(s);
         server_cache_machine_id(s);
 
-        r = system_journal_open(s, false);
-        if (r < 0)
-                return r;
-
-        return 0;
+        return system_journal_open(s, false);
 }
 
 void server_maybe_append_tags(Server *s) {