chiark / gitweb /
journald: invoking fstatvfs() is now redundant in the vacuuming code
[elogind.git] / src / journal / coredumpctl.c
index 08d8cdfeb7bdd7377e7be0c4905cdb72f703bd84..2158d7377194eedb6cd961eda53a88d25538dc91 100644 (file)
@@ -601,8 +601,10 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
         }
 
         if (filename && !endswith(filename, ".xz")) {
-                *path = filename;
-                filename = NULL;
+                if (path) {
+                        *path = filename;
+                        filename = NULL;
+                }
 
                 return 0;
         } else {
@@ -644,6 +646,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
                                 goto error;
                         }
                 } else if (filename) {
+#ifdef HAVE_XZ
                         _cleanup_close_ int fdf;
 
                         fdf = open(filename, O_RDONLY | O_CLOEXEC);
@@ -658,6 +661,11 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
                                 log_error("Failed to decompress %s: %s", filename, strerror(-r));
                                 goto error;
                         }
+#else
+                        log_error("Cannot decompress file. Compiled without XZ support.");
+                        r = -ENOTSUP;
+                        goto error;
+#endif
                 } else {
                         if (r == -ENOENT)
                                 log_error("Coredump neither in journal file nor stored externally on disk.");
@@ -712,8 +720,7 @@ static int dump_core(sd_journal* j) {
 }
 
 static int run_gdb(sd_journal *j) {
-
-        _cleanup_free_ char *exe = NULL, *coredump = NULL, *path = NULL;
+        _cleanup_free_ char *exe = NULL, *path = NULL;
         bool unlink_path = false;
         const char *data;
         siginfo_t st;