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;
}
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;
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;
}
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;
goto finish;
}
- close_nointr_nofail(fd);
- fd = -1;
+ fd = safe_close(fd);
pid = fork();
if (pid < 0) {