1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00

journalctl: static variables immediately configured via command line arguments should be prefixed with "arg_"

This commit is contained in:
Lennart Poettering 2015-01-05 01:08:51 +01:00
parent 2cf4172a71
commit 3774cf5708

View File

@ -50,8 +50,7 @@ static const char* arg_field = NULL;
static int arg_no_pager = false; static int arg_no_pager = false;
static int arg_no_legend = false; static int arg_no_legend = false;
static int arg_one = false; static int arg_one = false;
static FILE* arg_output = NULL;
static FILE* output = NULL;
static Set *new_matches(void) { static Set *new_matches(void) {
Set *set; Set *set;
@ -184,13 +183,13 @@ static int parse_argv(int argc, char *argv[], Set *matches) {
break; break;
case 'o': case 'o':
if (output) { if (arg_output) {
log_error("cannot set output more than once"); log_error("cannot set output more than once");
return -EINVAL; return -EINVAL;
} }
output = fopen(optarg, "we"); arg_output = fopen(optarg, "we");
if (!output) if (!arg_output)
return log_error_errno(errno, "writing to '%s': %m", optarg); return log_error_errno(errno, "writing to '%s': %m", optarg);
break; break;
@ -687,14 +686,14 @@ static int dump_core(sd_journal* j) {
if (r < 0) if (r < 0)
return r; return r;
print_info(output ? stdout : stderr, j, false); print_info(arg_output ? stdout : stderr, j, false);
if (on_tty() && !output) { if (on_tty() && !arg_output) {
log_error("Refusing to dump core to tty."); log_error("Refusing to dump core to tty.");
return -ENOTTY; return -ENOTTY;
} }
r = save_core(j, output ? fileno(output) : STDOUT_FILENO, NULL, NULL); r = save_core(j, arg_output ? fileno(arg_output) : STDOUT_FILENO, NULL, NULL);
if (r < 0) if (r < 0)
return log_error_errno(r, "Coredump retrieval failed: %m"); return log_error_errno(r, "Coredump retrieval failed: %m");
@ -855,8 +854,8 @@ int main(int argc, char *argv[]) {
end: end:
pager_close(); pager_close();
if (output) if (arg_output)
fclose(output); fclose(arg_output);
return r >= 0 ? r : EXIT_FAILURE; return r >= 0 ? r : EXIT_FAILURE;
} }