chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gpt-auto-generator: use _cleanup_ for blkid_free_probe
[elogind.git]
/
src
/
journal
/
coredumpctl.c
diff --git
a/src/journal/coredumpctl.c
b/src/journal/coredumpctl.c
index 99ca26932799d41ab54d389d7e4d22045bcd0d8d..75c96cc08112e41fff61c2181ba463dcfaf4bcaa 100644
(file)
--- 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 "path-util.h"
#include "pager.h"
#include "macro.h"
+#include "journal-internal.h"
static enum {
ACTION_NONE,
static enum {
ACTION_NONE,
@@
-67,10
+68,9
@@
static Set *new_matches(void) {
return NULL;
}
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));
if (r < 0) {
log_error("failed to add to set: %s", strerror(-r));
- free(tmp);
set_free(set);
return NULL;
}
set_free(set);
return NULL;
}
@@
-84,6
+84,7
@@
static int help(void) {
"Flags:\n"
" -o --output=FILE Write output to FILE\n"
" --no-pager Do not pipe output into a pager\n"
"Flags:\n"
" -o --output=FILE Write output to FILE\n"
" --no-pager Do not pipe output into a pager\n"
+ " --no-legend Do not print the column headers.\n\n"
"Commands:\n"
" -h --help Show this help\n"
"Commands:\n"
" -h --help Show this help\n"
@@
-103,7
+104,7
@@
static int add_match(Set *set, const char *match) {
unsigned pid;
const char* prefix;
char *pattern = NULL;
unsigned pid;
const char* prefix;
char *pattern = NULL;
-
char _cleanup_free_
*p = NULL;
+
_cleanup_free_ char
*p = NULL;
if (strchr(match, '='))
prefix = "";
if (strchr(match, '='))
prefix = "";
@@
-124,18
+125,17
@@
static int add_match(Set *set, const char *match) {
if (!pattern)
goto fail;
if (!pattern)
goto fail;
- r = set_put(set, pattern);
+ log_debug("Adding pattern: %s", pattern);
+ r = set_consume(set, pattern);
if (r < 0) {
if (r < 0) {
- log_error("
f
ailed to add pattern '%s': %s",
+ log_error("
F
ailed to add pattern '%s': %s",
pattern, strerror(-r));
goto fail;
}
pattern, strerror(-r));
goto fail;
}
- log_debug("Added pattern: %s", pattern);
return 0;
fail:
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;
}
return r;
}
@@
-268,7
+268,7
@@
static int retrieve(const void *data,
}
static void print_field(FILE* file, sd_journal *j) {
}
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;
const void *d;
size_t l;
@@
-281,7
+281,7
@@
static void print_field(FILE* file, sd_journal *j) {
}
static int print_entry(FILE* file, sd_journal *j, int had_legend) {
}
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;
*pid = NULL, *uid = NULL, *gid = NULL,
*sgnl = NULL, *exe = NULL;
const void *d;
@@
-342,7
+342,7
@@
static int dump_list(sd_journal *j) {
assert(j);
/* The coredumps are likely to compressed, and for just
assert(j);
/* The coredumps are likely to compressed, and for just
- * listing them we don
#
t need to decompress them, so let's
+ * listing them we don
'
t need to decompress them, so let's
* pick a fairly low data threshold here */
sd_journal_set_data_threshold(j, 4096);
* pick a fairly low data threshold here */
sd_journal_set_data_threshold(j, 4096);
@@
-519,11
+519,11
@@
finish:
}
int main(int argc, char *argv[]) {
}
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;
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();
setlocale(LC_ALL, "");
log_parse_environment();
@@
-557,6
+557,13
@@
int main(int argc, char *argv[]) {
}
}
}
}
+ if (_unlikely_(log_get_max_level() >= LOG_PRI(LOG_DEBUG))) {
+ _cleanup_free_ char *filter;
+
+ filter = journal_make_match_string(j);
+ log_debug("Journal filter: %s", filter);
+ }
+
switch(arg_action) {
case ACTION_LIST:
switch(arg_action) {
case ACTION_LIST: