chiark / gitweb /
remove unused includes
[elogind.git] / src / journal / catalog.c
index 67bf4ba017f3be7e319816f2392cf981b6d7a167..e505a05305fe241e49069e7e99b31a312ddf4f10 100644 (file)
@@ -26,7 +26,6 @@
 #include <string.h>
 #include <sys/mman.h>
 #include <locale.h>
-#include <libgen.h>
 
 #include "util.h"
 #include "log.h"
@@ -35,7 +34,6 @@
 #include "hashmap.h"
 #include "strv.h"
 #include "strbuf.h"
-#include "strxcpyx.h"
 #include "conf-files.h"
 #include "mkdir.h"
 #include "catalog.h"
@@ -209,14 +207,12 @@ int catalog_import_file(Hashmap *h, struct strbuf *sb, const char *path) {
         assert(path);
 
         f = fopen(path, "re");
-        if (!f) {
-                log_error("Failed to open file %s: %m", path);
-                return -errno;
-        }
+        if (!f)
+                return log_error_errno(errno, "Failed to open file %s: %m", path);
 
         r = catalog_file_lang(path, &deflang);
         if (r < 0)
-                log_error("Failed to determine language for file %s: %m", path);
+                log_error_errno(errno, "Failed to determine language for file %s: %m", path);
         if (r == 1)
                 log_debug("File %s has language %s.", path, deflang);
 
@@ -229,7 +225,7 @@ int catalog_import_file(Hashmap *h, struct strbuf *sb, const char *path) {
                         if (feof(f))
                                 break;
 
-                        log_error("Failed to read file %s: %m", path);
+                        log_error_errno(errno, "Failed to read file %s: %m", path);
                         return -errno;
                 }
 
@@ -341,17 +337,13 @@ static long write_catalog(const char *database, Hashmap *h, struct strbuf *sb,
                 return log_oom();
 
         r = mkdir_p(d, 0775);
-        if (r < 0) {
-                log_error_errno(r, "Recursive mkdir %s: %m", d);
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Recursive mkdir %s: %m", d);
 
         r = fopen_temporary(database, &w, &p);
-        if (r < 0) {
-                log_error_errno(r, "Failed to open database for writing: %s: %m",
-                                database);
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Failed to open database for writing: %s: %m",
+                                       database);
 
         zero(header);
         memcpy(header.signature, CATALOG_SIGNATURE, sizeof(header.signature));
@@ -389,7 +381,7 @@ static long write_catalog(const char *database, Hashmap *h, struct strbuf *sb,
         fchmod(fileno(w), 0644);
 
         if (rename(p, database) < 0) {
-                log_error("rename (%s -> %s) failed: %m", p, database);
+                log_error_errno(errno, "rename (%s -> %s) failed: %m", p, database);
                 r = -errno;
                 goto error;
         }