]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: improve some messages
authorLennart Poettering <lennart@poettering.net>
Fri, 2 Oct 2015 21:19:00 +0000 (23:19 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 2 Oct 2015 21:19:00 +0000 (23:19 +0200)
Indicate that we are ignoring errors, when we ignore them, and log that
at LOG_WARNING level.

Use the right error code for the log message.

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

index e21e4a88f1ac2a3148eb75ae75577f06a62eff4c..085d5f346dfcf286b3265d1509cc18c733ec34d5 100644 (file)
@@ -2859,8 +2859,7 @@ int journal_file_open_reliably(
                      random_u64()) < 0)
                 return -ENOMEM;
 
-        r = rename(fname, p);
-        if (r < 0)
+        if (rename(fname, p) < 0)
                 return -errno;
 
         /* btrfs doesn't cope well with our write pattern and
@@ -2869,7 +2868,7 @@ int journal_file_open_reliably(
         (void) chattr_path(p, false, FS_NOCOW_FL);
         (void) btrfs_defrag(p);
 
-        log_warning("File %s corrupted or uncleanly shut down, renaming and replacing.", fname);
+        log_warning_errno(r, "File %s corrupted or uncleanly shut down, renaming and replacing.", fname);
 
         return journal_file_open(fname, flags, mode, compress, seal, metrics, mmap_cache, template, ret);
 }
index 3538ddc13f25a95ef30627aa049798ed872c910a..5c896d22c130c544b00cbe570064ecc3da1bd660 100644 (file)
@@ -202,7 +202,7 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
 
         r = fchmod(f->fd, 0640);
         if (r < 0)
-                log_warning_errno(r, "Failed to fix access mode on %s, ignoring: %m", f->path);
+                log_warning_errno(errno, "Failed to fix access mode on %s, ignoring: %m", f->path);
 
 #ifdef HAVE_ACL
         if (uid <= SYSTEM_UID_MAX)
@@ -350,13 +350,13 @@ void server_sync(Server *s) {
         if (s->system_journal) {
                 r = journal_file_set_offline(s->system_journal);
                 if (r < 0)
-                        log_error_errno(r, "Failed to sync system journal: %m");
+                        log_warning_errno(r, "Failed to sync system journal, ignoring: %m");
         }
 
         ORDERED_HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
                 r = journal_file_set_offline(f);
                 if (r < 0)
-                        log_error_errno(r, "Failed to sync user journal: %m");
+                        log_warning_errno(r, "Failed to sync user journal, ignoring: %m");
         }
 
         if (s->sync_event_source) {