Blame SOURCES/0591-journal-remove-error-check-that-never-happens.patch

17b0f1
From 2b7119bc5e1a62d1bb6cb6ac0e4239345b9f8691 Mon Sep 17 00:00:00 2001
17b0f1
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
17b0f1
Date: Fri, 14 Aug 2015 23:40:27 +0200
17b0f1
Subject: [PATCH] journal: remove error check that never happens
17b0f1
17b0f1
remove_directory will always return 0 so this can never happen.
17b0f1
Besides that, d->path and d are freed so we would end up with
17b0f1
a null pointer dereference anyway.
17b0f1
17b0f1
(cherry picked from commit b2b46f91dbb71676cb981907c68521e4b1e80af1)
17b0f1
17b0f1
Related: #1465759
17b0f1
---
17b0f1
 src/journal/sd-journal.c | 12 +++---------
17b0f1
 1 file changed, 3 insertions(+), 9 deletions(-)
17b0f1
17b0f1
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
17b0f1
index 72f312b67c..3749f9e895 100644
17b0f1
--- a/src/journal/sd-journal.c
17b0f1
+++ b/src/journal/sd-journal.c
17b0f1
@@ -1487,7 +1487,7 @@ static int add_root_directory(sd_journal *j, const char *p) {
17b0f1
         return 0;
17b0f1
 }
17b0f1
 
17b0f1
-static int remove_directory(sd_journal *j, Directory *d) {
17b0f1
+static void remove_directory(sd_journal *j, Directory *d) {
17b0f1
         assert(j);
17b0f1
 
17b0f1
         if (d->wd > 0) {
17b0f1
@@ -1506,8 +1506,6 @@ static int remove_directory(sd_journal *j, Directory *d) {
17b0f1
 
17b0f1
         free(d->path);
17b0f1
         free(d);
17b0f1
-
17b0f1
-        return 0;
17b0f1
 }
17b0f1
 
17b0f1
 static int add_search_paths(sd_journal *j) {
17b0f1
@@ -2145,12 +2143,8 @@ static void process_inotify_event(sd_journal *j, struct inotify_event *e) {
17b0f1
 
17b0f1
                         /* Event for a subdirectory */
17b0f1
 
17b0f1
-                        if (e->mask & (IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT)) {
17b0f1
-                                r = remove_directory(j, d);
17b0f1
-                                if (r < 0)
17b0f1
-                                        log_debug_errno(r, "Failed to remove directory %s: %m", d->path);
17b0f1
-                        }
17b0f1
-
17b0f1
+                        if (e->mask & (IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT))
17b0f1
+                                remove_directory(j, d);
17b0f1
 
17b0f1
                 } else if (d->is_root && (e->mask & IN_ISDIR) && e->len > 0 && sd_id128_from_string(e->name, &id) >= 0) {
17b0f1