X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fcoredumpctl.c;h=5652c2f91a477b1a267f208cc3a8284d8940f012;hb=53789059e0e9378041697c25af06a08a433fb964;hp=99ca26932799d41ab54d389d7e4d22045bcd0d8d;hpb=763c7aa288485cf5ab627fe1d25ff58e76f9dacb;p=elogind.git diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c index 99ca26932..5652c2f91 100644 --- a/src/journal/coredumpctl.c +++ b/src/journal/coredumpctl.c @@ -35,6 +35,7 @@ #include "path-util.h" #include "pager.h" #include "macro.h" +#include "journal-internal.h" static enum { ACTION_NONE, @@ -67,10 +68,9 @@ static Set *new_matches(void) { return NULL; } - r = set_put(set, tmp); + r = set_consume(set, tmp); if (r < 0) { log_error("failed to add to set: %s", strerror(-r)); - free(tmp); set_free(set); return NULL; } @@ -103,7 +103,7 @@ static int add_match(Set *set, const char *match) { unsigned pid; const char* prefix; char *pattern = NULL; - char _cleanup_free_ *p = NULL; + _cleanup_free_ char *p = NULL; if (strchr(match, '=')) prefix = ""; @@ -124,18 +124,17 @@ static int add_match(Set *set, const char *match) { if (!pattern) goto fail; - r = set_put(set, pattern); + log_debug("Adding pattern: %s", pattern); + r = set_consume(set, pattern); if (r < 0) { - log_error("failed to add pattern '%s': %s", + log_error("Failed to add pattern '%s': %s", pattern, strerror(-r)); goto fail; } - log_debug("Added pattern: %s", pattern); return 0; fail: - free(pattern); - log_error("failed to add match: %s", strerror(-r)); + log_error("Failed to add match: %s", strerror(-r)); return r; } @@ -268,7 +267,7 @@ static int retrieve(const void *data, } static void print_field(FILE* file, sd_journal *j) { - const char _cleanup_free_ *value = NULL; + _cleanup_free_ const char *value = NULL; const void *d; size_t l; @@ -281,7 +280,7 @@ static void print_field(FILE* file, sd_journal *j) { } static int print_entry(FILE* file, sd_journal *j, int had_legend) { - const char _cleanup_free_ + _cleanup_free_ const char *pid = NULL, *uid = NULL, *gid = NULL, *sgnl = NULL, *exe = NULL; const void *d; @@ -519,11 +518,11 @@ finish: } int main(int argc, char *argv[]) { - sd_journal _cleanup_journal_close_ *j = NULL; + _cleanup_journal_close_ sd_journal*j = NULL; const char* match; Iterator it; int r = 0; - Set _cleanup_set_free_free_ *matches = NULL; + _cleanup_set_free_free_ Set *matches = NULL; setlocale(LC_ALL, ""); log_parse_environment();