chiark / gitweb /
man,journal: add note about sd_journal_get_cutoff_monotonic_usec return value
[elogind.git] / src / journal / coredumpctl.c
index ba785398260139439370cb1cb249954ac37e1125..d1450c09a28df907f772a9866fd58a1ac7dcc6cd 100644 (file)
@@ -595,14 +595,17 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
                 retrieve(data, len, "COREDUMP_FILENAME", &filename);
 
         if (filename && access(filename, R_OK) < 0) {
-                log_debug("File %s is not readable: %m", filename);
+                log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+                         "File %s is not readable: %m", filename);
                 free(filename);
                 filename = NULL;
         }
 
-        if (filename && !endswith(filename, ".xz")) {
-                *path = filename;
-                filename = NULL;
+        if (filename && !endswith(filename, ".xz") && !endswith(filename, ".lz4")) {
+                if (path) {
+                        *path = filename;
+                        filename = NULL;
+                }
 
                 return 0;
         } else {
@@ -644,7 +647,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
                                 goto error;
                         }
                 } else if (filename) {
-#if HAVE_XZ
+#if defined(HAVE_XZ) || defined(HAVE_LZ4)
                         _cleanup_close_ int fdf;
 
                         fdf = open(filename, O_RDONLY | O_CLOEXEC);
@@ -654,19 +657,19 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
                                 goto error;
                         }
 
-                        r = decompress_stream(fdf, fd, -1);
+                        r = decompress_stream(filename, fdf, fd, -1);
                         if (r < 0) {
                                 log_error("Failed to decompress %s: %s", filename, strerror(-r));
                                 goto error;
                         }
 #else
-                        log_error("Cannot decompress file. Compiled without XZ support.");
+                        log_error("Cannot decompress file. Compiled without compression support.");
                         r = -ENOTSUP;
                         goto error;
 #endif
                 } else {
                         if (r == -ENOENT)
-                                log_error("Coredump neither in journal file nor stored externally on disk.");
+                                log_error("Cannot retrieve coredump from journal nor disk.");
                         else
                                 log_error("Failed to retrieve COREDUMP field: %s", strerror(-r));
                         goto error;
@@ -718,8 +721,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;