chiark / gitweb /
Revert "Revert "coredumpctl: in case of error free pattern after print""
[elogind.git] / src / journal / coredumpctl.c
index bcfee46da1d989b273f77ec14a911d50c40758de..e564ab656c85c481f8934a6feeaba940cf06797e 100644 (file)
@@ -126,10 +126,11 @@ static int add_match(Set *set, const char *match) {
                 goto fail;
 
         log_debug("Adding pattern: %s", pattern);
-        r = set_consume(set, pattern);
+        r = set_put(set, pattern);
         if (r < 0) {
                 log_error("Failed to add pattern '%s': %s",
                           pattern, strerror(-r));
+                free(pattern);
                 goto fail;
         }
 
@@ -214,7 +215,7 @@ static int parse_argv(int argc, char *argv[], Set *matches) {
 
         if (optind < argc) {
                 const char *cmd = argv[optind++];
-                if(streq(cmd, "list"))
+                if (streq(cmd, "list"))
                         arg_action = ACTION_LIST;
                 else if (streq(cmd, "dump"))
                         arg_action = ACTION_DUMP;
@@ -416,7 +417,7 @@ static int dump_core(sd_journal* j) {
 
         r = sd_journal_previous(j);
         if (r >= 0)
-                log_warning("More than one entry matches, ignoring rest.\n");
+                log_warning("More than one entry matches, ignoring rest.");
 
         return 0;
 }
@@ -479,7 +480,7 @@ static int run_gdb(sd_journal *j) {
 
         sz = write(fd, data, len);
         if (sz < 0) {
-                log_error("Failed to write temporary file: %s", strerror(errno));
+                log_error("Failed to write temporary file: %m");
                 r = -errno;
                 goto finish;
         }