chiark / gitweb /
catalog: fix error codes handling in catalog_list_items
authorLukas Nykryn <lnykryn@redhat.com>
Wed, 27 Mar 2013 16:35:55 +0000 (17:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 27 Mar 2013 16:46:36 +0000 (12:46 -0400)
Previously r was set to zero and so if(r<0) was never true.

src/journal/catalog.c

index 6b195f6..7ae7b3e 100644 (file)
@@ -617,7 +617,7 @@ int catalog_list_items(FILE *f, bool oneline, char **items) {
                 if (k < 0) {
                         log_error("Failed to parse id128 '%s': %s",
                                   *item, strerror(-k));
-                        if (r < 0)
+                        if (r == 0)
                                 r = k;
                         continue;
                 }
@@ -627,7 +627,7 @@ int catalog_list_items(FILE *f, bool oneline, char **items) {
                         log_full(k == -ENOENT ? LOG_NOTICE : LOG_ERR,
                                  "Failed to retrieve catalog entry for '%s': %s",
                                   *item, strerror(-k));
-                        if (r < 0)
+                        if (r == 0)
                                 r = k;
                         continue;
                 }