]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: Handle EADDRNOTAVAIL as journal corruption
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 2 May 2023 07:16:16 +0000 (09:16 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 May 2023 10:17:41 +0000 (12:17 +0200)
Journal corruption is not only indicated by EBADMSG but also by
EADDRNOTAVAIL so treat that as corruption in a few more cases.

src/journal-remote/journal-remote-parse.c
src/libsystemd/sd-journal/journal-file.c
src/shared/logs-show.c

index 27ab5e5ac6c6a23ed7f53c8c9c59378c4146fd91..26e2009e14526d7ddda1fd459241405148bf8524 100644 (file)
@@ -73,7 +73,7 @@ int process_source(RemoteSource *source, JournalFileFlags file_flags) {
                          &source->importer.ts,
                          &source->importer.boot_id,
                          file_flags);
-        if (r == -EBADMSG) {
+        if (IN_SET(r, -EBADMSG, -EADDRNOTAVAIL)) {
                 log_warning_errno(r, "Entry is invalid, ignoring.");
                 r = 0;
         } else if (r < 0)
index fe2610be96fe2f609a793712bce9b4a73498aac7..501e7276b6d34b0f73d336b881be5d7e211a2ad3 100644 (file)
@@ -2865,7 +2865,7 @@ static int generic_array_bisect(
                         r = -EBADMSG;
                 else
                         r = test_object(f, p, needle);
-                if (r == -EBADMSG) {
+                if (IN_SET(r, -EBADMSG, -EADDRNOTAVAIL)) {
                         log_debug_errno(r, "Encountered invalid entry while bisecting, cutting algorithm short. (1)");
                         n = i;
                         continue;
@@ -2948,7 +2948,7 @@ static int generic_array_bisect(
                                         r = -EBADMSG;
                                 else
                                         r = test_object(f, p, needle);
-                                if (r == -EBADMSG) {
+                                if (IN_SET(r, -EBADMSG, -EADDRNOTAVAIL)) {
                                         log_debug_errno(r, "Encountered invalid entry while bisecting, cutting algorithm short. (2)");
                                         right = n = i;
                                         continue;
index d372e096c494afd3f8d606307909183852e02d31..539d3963de7ca94f6b69770d24157a916240ead6 100644 (file)
@@ -509,7 +509,7 @@ static int output_short(
                 if (r < 0)
                         return r;
         }
-        if (r == -EBADMSG) {
+        if (IN_SET(r, -EBADMSG, -EADDRNOTAVAIL)) {
                 log_debug_errno(r, "Skipping message we can't read: %m");
                 return 0;
         }
@@ -868,7 +868,7 @@ static int output_export(
 
                 fputc('\n', f);
         }
-        if (r == -EBADMSG) {
+        if (IN_SET(r, -EADDRNOTAVAIL, -EBADMSG)) {
                 log_debug_errno(r, "Skipping message we can't read: %m");
                 return 0;
         }
@@ -1116,7 +1116,7 @@ static int output_json(
                 size_t size;
 
                 r = sd_journal_enumerate_data(j, &data, &size);
-                if (r == -EBADMSG) {
+                if (IN_SET(r, -EBADMSG, -EADDRNOTAVAIL)) {
                         log_debug_errno(r, "Skipping message we can't read: %m");
                         r = 0;
                         goto finish;
@@ -1204,7 +1204,7 @@ static int output_cat_field(
                 get_log_colors(prio, &color_on, &color_off, &highlight_on);
 
         r = sd_journal_get_data(j, field, &data, &l);
-        if (r == -EBADMSG) {
+        if (IN_SET(r, -EBADMSG, -EADDRNOTAVAIL)) {
                 log_debug_errno(r, "Skipping message we can't read: %m");
                 return 0;
         }
@@ -1276,7 +1276,7 @@ static int output_cat(
                 /* Determine priority of this entry, so that we can color it nicely */
 
                 r = sd_journal_get_data(j, "PRIORITY", &data, &l);
-                if (r == -EBADMSG) {
+                if (IN_SET(r, -EBADMSG, -EADDRNOTAVAIL)) {
                         log_debug_errno(r, "Skipping message we can't read: %m");
                         return 0;
                 }
@@ -1420,7 +1420,7 @@ int show_journal_entry(
                 n_columns = columns();
 
         r = get_display_timestamp(j, &display_ts, &boot_id);
-        if (r == -EBADMSG) {
+        if (IN_SET(r, -EBADMSG, -EADDRNOTAVAIL)) {
                 log_debug_errno(r, "Skipping message we can't read: %m");
                 return 0;
         }