X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fcoredumpctl.c;h=bf943bc032528ca717630c5c293570f5d736409d;hb=76cf10dab7a36653a159f0e87c46a13df494474f;hp=2b24ff8a94f579d09a6f9323f9e9cff62e989874;hpb=f168c27313e4d7b0aabee037dc9c78a5799f0597;p=elogind.git diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c index 2b24ff8a9..bf943bc03 100644 --- a/src/journal/coredumpctl.c +++ b/src/journal/coredumpctl.c @@ -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; } @@ -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; } @@ -471,7 +472,7 @@ static int run_gdb(sd_journal *j) { data = (const uint8_t*) data + 9; len -= 9; - fd = mkostemp(path, O_WRONLY); + fd = mkostemp_safe(path, O_WRONLY|O_CLOEXEC); if (fd < 0) { log_error("Failed to create temporary file: %m"); return -errno; @@ -489,8 +490,7 @@ static int run_gdb(sd_journal *j) { goto finish; } - close_nointr_nofail(fd); - fd = -1; + fd = safe_close(fd); pid = fork(); if (pid < 0) {