1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-03 01:17:45 +03:00

Make pager_open() return void

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-08-03 16:59:09 +02:00
parent 028f7d3ac6
commit 384c2c3239
38 changed files with 96 additions and 100 deletions

View File

@ -1051,7 +1051,7 @@ static int analyze_critical_chain(int argc, char *argv[], void *userdata) {
} }
unit_times_hashmap = h; unit_times_hashmap = h;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
puts("The time when unit became active or started is printed after the \"@\" character.\n" puts("The time when unit became active or started is printed after the \"@\" character.\n"
"The time the unit took to start is printed after the \"+\" character.\n"); "The time the unit took to start is printed after the \"+\" character.\n");
@ -1121,7 +1121,7 @@ static int analyze_blame(int argc, char *argv[], void *userdata) {
return table_log_add_error(r); return table_log_add_error(r);
} }
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
return table_print(table, NULL); return table_print(table, NULL);
} }
@ -1349,7 +1349,7 @@ static int dump(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return bus_log_connect_error(r); return bus_log_connect_error(r);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (!sd_bus_can_send(bus, SD_BUS_TYPE_UNIX_FD)) if (!sd_bus_can_send(bus, SD_BUS_TYPE_UNIX_FD))
return dump_fallback(bus); return dump_fallback(bus);
@ -1376,7 +1376,7 @@ static int cat_config(int argc, char *argv[], void *userdata) {
char **arg, **list; char **arg, **list;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
list = strv_skip(argv, 1); list = strv_skip(argv, 1);
STRV_FOREACH(arg, list) { STRV_FOREACH(arg, list) {
@ -1523,7 +1523,7 @@ static int dump_exit_status(int argc, char *argv[], void *userdata) {
return table_log_add_error(r); return table_log_add_error(r);
} }
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
return table_print(table, NULL); return table_print(table, NULL);
} }
@ -1568,7 +1568,7 @@ static int dump_capabilities(int argc, char *argv[], void *userdata) {
(void) table_set_sort(table, (size_t) 1); (void) table_set_sort(table, (size_t) 1);
} }
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
return table_print(table, NULL); return table_print(table, NULL);
} }
@ -1652,7 +1652,7 @@ static void dump_syscall_filter(const SyscallFilterSet *set) {
static int dump_syscall_filters(int argc, char *argv[], void *userdata) { static int dump_syscall_filters(int argc, char *argv[], void *userdata) {
bool first = true; bool first = true;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (strv_isempty(strv_skip(argv, 1))) { if (strv_isempty(strv_skip(argv, 1))) {
_cleanup_set_free_ Set *kernel = NULL, *known = NULL; _cleanup_set_free_ Set *kernel = NULL, *known = NULL;
@ -1824,7 +1824,7 @@ static int dump_filesystems(int argc, char *argv[], void *userdata) {
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Not compiled with libbpf support, sorry."); return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Not compiled with libbpf support, sorry.");
#endif #endif
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (strv_isempty(strv_skip(argv, 1))) { if (strv_isempty(strv_skip(argv, 1))) {
_cleanup_set_free_ Set *kernel = NULL, *known = NULL; _cleanup_set_free_ Set *kernel = NULL, *known = NULL;
@ -2270,7 +2270,7 @@ static int do_security(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return bus_log_connect_error(r); return bus_log_connect_error(r);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (arg_security_policy) { if (arg_security_policy) {
r = json_parse_file(/*f=*/ NULL, arg_security_policy, /*flags=*/ 0, &policy, &line, &column); r = json_parse_file(/*f=*/ NULL, arg_security_policy, /*flags=*/ 0, &policy, &line, &column);
@ -2309,7 +2309,7 @@ static int help(int argc, char *argv[], void *userdata) {
_cleanup_free_ char *link = NULL, *dot_link = NULL; _cleanup_free_ char *link = NULL, *dot_link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("systemd-analyze", "1", &link); r = terminal_urlify_man("systemd-analyze", "1", &link);
if (r < 0) if (r < 0)

View File

@ -217,7 +217,7 @@ static int run(int argc, char *argv[]) {
return log_error_errno(r, "Failed to enumerate binfmt.d files: %m"); return log_error_errno(r, "Failed to enumerate binfmt.d files: %m");
if (arg_cat_config) { if (arg_cat_config) {
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
return cat_files(NULL, files, 0); return cat_files(NULL, files, 0);
} }

View File

@ -1286,7 +1286,7 @@ static int verb_status(int argc, char *argv[], void *userdata) {
r = 0; /* If we couldn't determine the path, then don't consider that a problem from here on, just show what we r = 0; /* If we couldn't determine the path, then don't consider that a problem from here on, just show what we
* can show */ * can show */
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (is_efi_boot()) { if (is_efi_boot()) {
static const struct { static const struct {
@ -1444,7 +1444,7 @@ static int verb_list(int argc, char *argv[], void *userdata) {
if (config.n_entries == 0) if (config.n_entries == 0)
log_info("No boot loader entries found."); log_info("No boot loader entries found.");
else { else {
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
printf("Boot Loader Entries:\n"); printf("Boot Loader Entries:\n");

View File

@ -486,7 +486,7 @@ static int tree_one(sd_bus *bus, const char *service) {
return log_oom(); return log_oom();
} }
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
l = set_get_strv(done); l = set_get_strv(done);
if (!l) if (!l)
@ -526,7 +526,7 @@ static int tree(int argc, char **argv, void *userdata) {
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to get name list: %m"); return log_error_errno(r, "Failed to get name list: %m");
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
STRV_FOREACH(i, names) { STRV_FOREACH(i, names) {
int q; int q;
@ -556,7 +556,7 @@ static int tree(int argc, char **argv, void *userdata) {
printf("\n"); printf("\n");
if (argv[2]) { if (argv[2]) {
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
printf("Service %s%s%s:\n", ansi_highlight(), *i, ansi_normal()); printf("Service %s%s%s:\n", ansi_highlight(), *i, ansi_normal());
} }
@ -979,7 +979,7 @@ static int introspect(int argc, char **argv, void *userdata) {
if (arg_xml_interface) { if (arg_xml_interface) {
/* Just dump the received XML and finish */ /* Just dump the received XML and finish */
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
puts(xml); puts(xml);
return 0; return 0;
} }
@ -1098,7 +1098,7 @@ static int introspect(int argc, char **argv, void *userdata) {
typesafe_qsort(sorted, k, member_compare_funcp); typesafe_qsort(sorted, k, member_compare_funcp);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (arg_legend) if (arg_legend)
printf("%-*s %-*s %-*s %-*s %s\n", printf("%-*s %-*s %-*s %-*s %s\n",
@ -1358,7 +1358,7 @@ static int status(int argc, char **argv, void *userdata) {
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (!isempty(argv[1])) { if (!isempty(argv[1])) {
r = parse_pid(argv[1], &pid); r = parse_pid(argv[1], &pid);
@ -2038,7 +2038,7 @@ static int call(int argc, char **argv, void *userdata) {
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL; _cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
if (arg_json_format_flags & (JSON_FORMAT_PRETTY|JSON_FORMAT_PRETTY_AUTO)) if (arg_json_format_flags & (JSON_FORMAT_PRETTY|JSON_FORMAT_PRETTY_AUTO))
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = json_transform_message(reply, &v); r = json_transform_message(reply, &v);
if (r < 0) if (r < 0)
@ -2047,7 +2047,7 @@ static int call(int argc, char **argv, void *userdata) {
json_variant_dump(v, arg_json_format_flags, NULL, NULL); json_variant_dump(v, arg_json_format_flags, NULL, NULL);
} else if (arg_verbose) { } else if (arg_verbose) {
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = sd_bus_message_dump(reply, stdout, 0); r = sd_bus_message_dump(reply, stdout, 0);
if (r < 0) if (r < 0)
@ -2147,7 +2147,7 @@ static int get_property(int argc, char **argv, void *userdata) {
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL; _cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
if (arg_json_format_flags & (JSON_FORMAT_PRETTY|JSON_FORMAT_PRETTY_AUTO)) if (arg_json_format_flags & (JSON_FORMAT_PRETTY|JSON_FORMAT_PRETTY_AUTO))
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = json_transform_variant(reply, contents, &v); r = json_transform_variant(reply, contents, &v);
if (r < 0) if (r < 0)
@ -2156,7 +2156,7 @@ static int get_property(int argc, char **argv, void *userdata) {
json_variant_dump(v, arg_json_format_flags, NULL, NULL); json_variant_dump(v, arg_json_format_flags, NULL, NULL);
} else if (arg_verbose) { } else if (arg_verbose) {
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = sd_bus_message_dump(reply, stdout, SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY); r = sd_bus_message_dump(reply, stdout, SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY);
if (r < 0) if (r < 0)
@ -2233,7 +2233,7 @@ static int help(void) {
if (r < 0) if (r < 0)
return log_oom(); return log_oom();
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
printf("%s [OPTIONS...] COMMAND ...\n\n" printf("%s [OPTIONS...] COMMAND ...\n\n"
"%sIntrospect the D-Bus IPC bus.%s\n" "%sIntrospect the D-Bus IPC bus.%s\n"

View File

@ -191,8 +191,8 @@ static int run(int argc, char *argv[]) {
if (r <= 0) if (r <= 0)
return r; return r;
r = pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (r > 0 && arg_full < 0) if (arg_full < 0 && pager_have())
arg_full = true; arg_full = true;
if (arg_full > 0) if (arg_full > 0)

View File

@ -2902,7 +2902,7 @@ int main(int argc, char *argv[]) {
goto finish; goto finish;
if (IN_SET(arg_action, ACTION_TEST, ACTION_HELP, ACTION_DUMP_CONFIGURATION_ITEMS, ACTION_DUMP_BUS_PROPERTIES, ACTION_BUS_INTROSPECT)) if (IN_SET(arg_action, ACTION_TEST, ACTION_HELP, ACTION_DUMP_CONFIGURATION_ITEMS, ACTION_DUMP_BUS_PROPERTIES, ACTION_BUS_INTROSPECT))
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (arg_action != ACTION_RUN) if (arg_action != ACTION_RUN)
skip_setup = true; skip_setup = true;

View File

@ -824,7 +824,7 @@ static int dump_list(int argc, char **argv, void *userdata) {
(void) table_set_empty_string(t, "-"); (void) table_set_empty_string(t, "-");
} else } else
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
/* "info" without pattern implies "-1" */ /* "info" without pattern implies "-1" */
if ((arg_rows_max == 1 && arg_reverse) || (verb_is_info && argc == 1)) { if ((arg_rows_max == 1 && arg_reverse) || (verb_is_info && argc == 1)) {

View File

@ -649,7 +649,7 @@ static int run(int argc, char *argv[]) {
else if (arg_diff) else if (arg_diff)
arg_flags |= SHOW_OVERRIDDEN; arg_flags |= SHOW_OVERRIDDEN;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (optind < argc) { if (optind < argc) {
int i; int i;

View File

@ -379,7 +379,7 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) {
assert(d); assert(d);
if (arg_json_format_flags & (JSON_FORMAT_OFF|JSON_FORMAT_PRETTY|JSON_FORMAT_PRETTY_AUTO)) if (arg_json_format_flags & (JSON_FORMAT_OFF|JSON_FORMAT_PRETTY|JSON_FORMAT_PRETTY_AUTO))
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (arg_json_format_flags & JSON_FORMAT_OFF) if (arg_json_format_flags & JSON_FORMAT_OFF)
printf(" Name: %s\n", basename(arg_image)); printf(" Name: %s\n", basename(arg_image));

View File

@ -613,7 +613,7 @@ static int inspect_home(int argc, char *argv[], void *userdata) {
int r, ret = 0; int r, ret = 0;
char **items, **i; char **items, **i;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = acquire_bus(&bus); r = acquire_bus(&bus);
if (r < 0) if (r < 0)
@ -2020,7 +2020,7 @@ static int help(int argc, char *argv[], void *userdata) {
_cleanup_free_ char *link = NULL; _cleanup_free_ char *link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("homectl", "1", &link); r = terminal_urlify_man("homectl", "1", &link);
if (r < 0) if (r < 0)

View File

@ -327,7 +327,7 @@ static int help(void) {
_cleanup_free_ char *link = NULL; _cleanup_free_ char *link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("journalctl", "1", &link); r = terminal_urlify_man("journalctl", "1", &link);
if (r < 0) if (r < 0)
@ -1445,7 +1445,7 @@ static int list_boots(sd_journal *j) {
if (count == 0) if (count == 0)
return count; return count;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
/* numbers are one less, but we need an extra char for the sign */ /* numbers are one less, but we need an extra char for the sign */
w = DECIMAL_STR_WIDTH(count - 1) + 1; w = DECIMAL_STR_WIDTH(count - 1) + 1;
@ -2193,7 +2193,7 @@ int main(int argc, char *argv[]) {
} else { } else {
bool oneline = arg_action == ACTION_LIST_CATALOG; bool oneline = arg_action == ACTION_LIST_CATALOG;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (optind < argc) if (optind < argc)
r = catalog_list_items(stdout, database, oneline, argv + optind); r = catalog_list_items(stdout, database, oneline, argv + optind);
@ -2586,7 +2586,7 @@ int main(int argc, char *argv[]) {
need_seek = true; need_seek = true;
if (!arg_follow) if (!arg_follow)
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (!arg_quiet && (arg_lines != 0 || arg_follow)) { if (!arg_quiet && (arg_lines != 0 || arg_follow)) {
usec_t start, end; usec_t start, end;

View File

@ -193,7 +193,7 @@ static int list_locales(int argc, char **argv, void *userdata) {
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to read list of locales: %m"); return log_error_errno(r, "Failed to read list of locales: %m");
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
strv_print(l); strv_print(l);
return 0; return 0;
@ -233,7 +233,7 @@ static int list_vconsole_keymaps(int argc, char **argv, void *userdata) {
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to read list of keymaps: %m"); return log_error_errno(r, "Failed to read list of keymaps: %m");
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
strv_print(l); strv_print(l);
@ -362,7 +362,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) {
strv_sort(list); strv_sort(list);
strv_uniq(list); strv_uniq(list);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
strv_print(list); strv_print(list);
return 0; return 0;

View File

@ -70,7 +70,7 @@ static int print_inhibitors(sd_bus *bus) {
_cleanup_(table_unrefp) Table *table = NULL; _cleanup_(table_unrefp) Table *table = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = sd_bus_call_method( r = sd_bus_call_method(
bus, bus,

View File

@ -123,7 +123,7 @@ static int list_sessions(int argc, char *argv[], void *userdata) {
assert(bus); assert(bus);
assert(argv); assert(argv);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = bus_call_method(bus, bus_login_mgr, "ListSessions", &error, &reply, NULL); r = bus_call_method(bus, bus_login_mgr, "ListSessions", &error, &reply, NULL);
if (r < 0) if (r < 0)
@ -197,7 +197,7 @@ static int list_users(int argc, char *argv[], void *userdata) {
assert(bus); assert(bus);
assert(argv); assert(argv);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = bus_call_method(bus, bus_login_mgr, "ListUsers", &error, &reply, NULL); r = bus_call_method(bus, bus_login_mgr, "ListUsers", &error, &reply, NULL);
if (r < 0) if (r < 0)
@ -247,7 +247,7 @@ static int list_seats(int argc, char *argv[], void *userdata) {
assert(bus); assert(bus);
assert(argv); assert(argv);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = bus_call_method(bus, bus_login_mgr, "ListSeats", &error, &reply, NULL); r = bus_call_method(bus, bus_login_mgr, "ListSeats", &error, &reply, NULL);
if (r < 0) if (r < 0)
@ -810,7 +810,7 @@ static int show_session(int argc, char *argv[], void *userdata) {
properties = !strstr(argv[0], "status"); properties = !strstr(argv[0], "status");
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (argc <= 1) { if (argc <= 1) {
/* If no argument is specified inspect the manager itself */ /* If no argument is specified inspect the manager itself */
@ -847,7 +847,7 @@ static int show_user(int argc, char *argv[], void *userdata) {
properties = !strstr(argv[0], "status"); properties = !strstr(argv[0], "status");
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (argc <= 1) { if (argc <= 1) {
/* If no argument is specified inspect the manager itself */ /* If no argument is specified inspect the manager itself */
@ -904,7 +904,7 @@ static int show_seat(int argc, char *argv[], void *userdata) {
properties = !strstr(argv[0], "status"); properties = !strstr(argv[0], "status");
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (argc <= 1) { if (argc <= 1) {
/* If no argument is specified inspect the manager itself */ /* If no argument is specified inspect the manager itself */
@ -1219,7 +1219,7 @@ static int help(int argc, char *argv[], void *userdata) {
_cleanup_free_ char *link = NULL; _cleanup_free_ char *link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("loginctl", "1", &link); r = terminal_urlify_man("loginctl", "1", &link);
if (r < 0) if (r < 0)

View File

@ -273,7 +273,7 @@ static int list_machines(int argc, char *argv[], void *userdata) {
assert(bus); assert(bus);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = bus_call_method(bus, bus_machine_mgr, "ListMachines", &error, &reply, NULL); r = bus_call_method(bus, bus_machine_mgr, "ListMachines", &error, &reply, NULL);
if (r < 0) if (r < 0)
@ -352,7 +352,7 @@ static int list_images(int argc, char *argv[], void *userdata) {
assert(bus); assert(bus);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = bus_call_method(bus, bus_machine_mgr, "ListImages", &error, &reply, NULL); r = bus_call_method(bus, bus_machine_mgr, "ListImages", &error, &reply, NULL);
if (r < 0) if (r < 0)
@ -705,7 +705,7 @@ static int show_machine(int argc, char *argv[], void *userdata) {
properties = !strstr(argv[0], "status"); properties = !strstr(argv[0], "status");
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (properties && argc <= 1) { if (properties && argc <= 1) {
@ -1004,7 +1004,7 @@ static int show_image(int argc, char *argv[], void *userdata) {
properties = !strstr(argv[0], "status"); properties = !strstr(argv[0], "status");
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (argc <= 1) { if (argc <= 1) {
@ -2251,7 +2251,7 @@ static int list_transfers(int argc, char *argv[], void *userdata) {
double progress; double progress;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = bus_call_method(bus, bus_import_mgr, "ListTransfers", &error, &reply, NULL); r = bus_call_method(bus, bus_import_mgr, "ListTransfers", &error, &reply, NULL);
if (r < 0) if (r < 0)
@ -2446,7 +2446,7 @@ static int help(int argc, char *argv[], void *userdata) {
_cleanup_free_ char *link = NULL; _cleanup_free_ char *link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("machinectl", "1", &link); r = terminal_urlify_man("machinectl", "1", &link);
if (r < 0) if (r < 0)

View File

@ -1432,7 +1432,7 @@ static int list_devices(void) {
} }
} }
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = table_print(table, NULL); r = table_print(table, NULL);
if (r < 0) if (r < 0)

View File

@ -810,7 +810,7 @@ static int list_links(int argc, char *argv[], void *userdata) {
if (c < 0) if (c < 0)
return c; return c;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
table = table_new("idx", "link", "type", "operational", "setup"); table = table_new("idx", "link", "type", "operational", "setup");
if (!table) if (!table)
@ -2394,7 +2394,7 @@ static int link_status(int argc, char *argv[], void *userdata) {
return dump_link_description(strv_skip(argv, 1)); return dump_link_description(strv_skip(argv, 1));
} }
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = sd_bus_open_system(&bus); r = sd_bus_open_system(&bus);
if (r < 0) if (r < 0)
@ -2493,7 +2493,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
if (c < 0) if (c < 0)
return c; return c;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
table = table_new("link", table = table_new("link",
"chassis id", "chassis id",

View File

@ -304,7 +304,7 @@ static int help(void) {
_cleanup_free_ char *link = NULL; _cleanup_free_ char *link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("systemd-nspawn", "1", &link); r = terminal_urlify_man("systemd-nspawn", "1", &link);
if (r < 0) if (r < 0)

View File

@ -16,7 +16,7 @@ static int help(int argc, char *argv[], void *userdata) {
_cleanup_free_ char *link = NULL; _cleanup_free_ char *link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("oomctl", "1", &link); r = terminal_urlify_man("oomctl", "1", &link);
if (r < 0) if (r < 0)
@ -52,7 +52,7 @@ static int dump_state(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to connect system bus: %m"); return log_error_errno(r, "Failed to connect system bus: %m");
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = sd_bus_call_method( r = sd_bus_call_method(
bus, bus,

View File

@ -333,7 +333,7 @@ static int inspect_image(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return bus_log_parse_error(r); return bus_log_parse_error(r);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (arg_cat) { if (arg_cat) {
printf("%s-- OS Release: --%s\n", ansi_highlight(), ansi_normal()); printf("%s-- OS Release: --%s\n", ansi_highlight(), ansi_normal());
@ -1093,7 +1093,7 @@ static int help(int argc, char *argv[], void *userdata) {
_cleanup_free_ char *link = NULL; _cleanup_free_ char *link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("portablectl", "1", &link); r = terminal_urlify_man("portablectl", "1", &link);
if (r < 0) if (r < 0)

View File

@ -1587,7 +1587,7 @@ static int status_ifindex(sd_bus *bus, int ifindex, const char *name, StatusMode
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to get link data for %i: %s", ifindex, bus_error_message(&error, r)); return log_error_errno(r, "Failed to get link data for %i: %s", ifindex, bus_error_message(&error, r));
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (mode == STATUS_DNS) if (mode == STATUS_DNS)
return status_print_strv_ifindex(ifindex, name, link_info.dns_ex ?: link_info.dns); return status_print_strv_ifindex(ifindex, name, link_info.dns_ex ?: link_info.dns);
@ -1851,7 +1851,7 @@ static int status_global(sd_bus *bus, StatusMode mode, bool *empty_line) {
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to get global data: %s", bus_error_message(&error, r)); return log_error_errno(r, "Failed to get global data: %s", bus_error_message(&error, r));
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (mode == STATUS_DNS) if (mode == STATUS_DNS)
return status_print_strv_global(global_info.dns_ex ?: global_info.dns); return status_print_strv_global(global_info.dns_ex ?: global_info.dns);

View File

@ -2783,7 +2783,7 @@ int table_print_with_pager(
* the table header and logs about any error. */ * the table header and logs about any error. */
if (json_format_flags & (JSON_FORMAT_OFF|JSON_FORMAT_PRETTY|JSON_FORMAT_PRETTY_AUTO)) if (json_format_flags & (JSON_FORMAT_OFF|JSON_FORMAT_PRETTY|JSON_FORMAT_PRETTY_AUTO))
(void) pager_open(pager_flags); pager_open(pager_flags);
saved_header = t->header; saved_header = t->header;
t->header = show_header; t->header = show_header;

View File

@ -83,23 +83,23 @@ static int no_quit_on_interrupt(int exe_name_fd, const char *less_opts) {
return r; return r;
} }
int pager_open(PagerFlags flags) { void pager_open(PagerFlags flags) {
_cleanup_close_pair_ int fd[2] = { -1, -1 }, exe_name_pipe[2] = { -1, -1 }; _cleanup_close_pair_ int fd[2] = { -1, -1 }, exe_name_pipe[2] = { -1, -1 };
_cleanup_strv_free_ char **pager_args = NULL; _cleanup_strv_free_ char **pager_args = NULL;
const char *pager, *less_opts; const char *pager, *less_opts;
int r; int r;
if (flags & PAGER_DISABLE) if (flags & PAGER_DISABLE)
return 0; return;
if (pager_pid > 0) if (pager_pid > 0)
return 1; return;
if (terminal_is_dumb()) if (terminal_is_dumb())
return 0; return;
if (!is_main_thread()) if (!is_main_thread())
return log_error_errno(SYNTHETIC_ERRNO(EPERM), "Pager invoked from wrong thread."); return (void) log_error_errno(SYNTHETIC_ERRNO(EPERM), "Pager invoked from wrong thread.");
pager = getenv("SYSTEMD_PAGER"); pager = getenv("SYSTEMD_PAGER");
if (!pager) if (!pager)
@ -108,11 +108,11 @@ int pager_open(PagerFlags flags) {
if (pager) { if (pager) {
pager_args = strv_split(pager, WHITESPACE); pager_args = strv_split(pager, WHITESPACE);
if (!pager_args) if (!pager_args)
return log_oom(); return (void) log_oom();
/* If the pager is explicitly turned off, honour it */ /* If the pager is explicitly turned off, honour it */
if (strv_isempty(pager_args) || strv_equal(pager_args, STRV_MAKE("cat"))) if (strv_isempty(pager_args) || strv_equal(pager_args, STRV_MAKE("cat")))
return 0; return;
} }
/* Determine and cache number of columns/lines before we spawn the pager so that we get the value from the /* Determine and cache number of columns/lines before we spawn the pager so that we get the value from the
@ -121,11 +121,11 @@ int pager_open(PagerFlags flags) {
(void) lines(); (void) lines();
if (pipe2(fd, O_CLOEXEC) < 0) if (pipe2(fd, O_CLOEXEC) < 0)
return log_error_errno(errno, "Failed to create pager pipe: %m"); return (void) log_error_errno(errno, "Failed to create pager pipe: %m");
/* This is a pipe to feed the name of the executed pager binary into the parent */ /* This is a pipe to feed the name of the executed pager binary into the parent */
if (pipe2(exe_name_pipe, O_CLOEXEC) < 0) if (pipe2(exe_name_pipe, O_CLOEXEC) < 0)
return log_error_errno(errno, "Failed to create exe_name pipe: %m"); return (void) log_error_errno(errno, "Failed to create exe_name pipe: %m");
/* Initialize a good set of less options */ /* Initialize a good set of less options */
less_opts = getenv("SYSTEMD_LESS"); less_opts = getenv("SYSTEMD_LESS");
@ -137,7 +137,7 @@ int pager_open(PagerFlags flags) {
/* We set SIGINT as PR_DEATHSIG signal here, to match the "K" parameter we set in $LESS, which enables SIGINT behaviour. */ /* We set SIGINT as PR_DEATHSIG signal here, to match the "K" parameter we set in $LESS, which enables SIGINT behaviour. */
r = safe_fork("(pager)", FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGINT|FORK_RLIMIT_NOFILE_SAFE|FORK_LOG, &pager_pid); r = safe_fork("(pager)", FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGINT|FORK_RLIMIT_NOFILE_SAFE|FORK_LOG, &pager_pid);
if (r < 0) if (r < 0)
return r; return;
if (r == 0) { if (r == 0) {
const char *less_charset, *exe; const char *less_charset, *exe;
@ -245,26 +245,22 @@ int pager_open(PagerFlags flags) {
stored_stdout = fcntl(STDOUT_FILENO, F_DUPFD_CLOEXEC, 3); stored_stdout = fcntl(STDOUT_FILENO, F_DUPFD_CLOEXEC, 3);
if (dup2(fd[1], STDOUT_FILENO) < 0) { if (dup2(fd[1], STDOUT_FILENO) < 0) {
stored_stdout = safe_close(stored_stdout); stored_stdout = safe_close(stored_stdout);
return log_error_errno(errno, "Failed to duplicate pager pipe: %m"); return (void) log_error_errno(errno, "Failed to duplicate pager pipe: %m");
} }
stdout_redirected = true; stdout_redirected = true;
stored_stderr = fcntl(STDERR_FILENO, F_DUPFD_CLOEXEC, 3); stored_stderr = fcntl(STDERR_FILENO, F_DUPFD_CLOEXEC, 3);
if (dup2(fd[1], STDERR_FILENO) < 0) { if (dup2(fd[1], STDERR_FILENO) < 0) {
stored_stderr = safe_close(stored_stderr); stored_stderr = safe_close(stored_stderr);
return log_error_errno(errno, "Failed to duplicate pager pipe: %m"); return (void) log_error_errno(errno, "Failed to duplicate pager pipe: %m");
} }
stderr_redirected = true; stderr_redirected = true;
exe_name_pipe[1] = safe_close(exe_name_pipe[1]); exe_name_pipe[1] = safe_close(exe_name_pipe[1]);
r = no_quit_on_interrupt(TAKE_FD(exe_name_pipe[0]), less_opts); r = no_quit_on_interrupt(TAKE_FD(exe_name_pipe[0]), less_opts);
if (r < 0)
return r;
if (r > 0) if (r > 0)
(void) ignore_signals(SIGINT); (void) ignore_signals(SIGINT);
return 1;
} }
void pager_close(void) { void pager_close(void) {

View File

@ -10,7 +10,7 @@ typedef enum PagerFlags {
PAGER_JUMP_TO_END = 1 << 1, PAGER_JUMP_TO_END = 1 << 1,
} PagerFlags; } PagerFlags;
int pager_open(PagerFlags flags); void pager_open(PagerFlags flags);
void pager_close(void); void pager_close(void);
bool pager_have(void) _pure_; bool pager_have(void) _pure_;

View File

@ -410,7 +410,7 @@ static int run(int argc, char *argv[]) {
return log_error_errno(r, "Failed to enumerate sysctl.d files: %m"); return log_error_errno(r, "Failed to enumerate sysctl.d files: %m");
if (arg_cat_config) { if (arg_cat_config) {
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
return cat_files(NULL, files, 0); return cat_files(NULL, files, 0);
} }

View File

@ -54,7 +54,7 @@ int cat(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
STRV_FOREACH(name, names) { STRV_FOREACH(name, names) {
_cleanup_free_ char *fragment_path = NULL; _cleanup_free_ char *fragment_path = NULL;

View File

@ -157,7 +157,7 @@ int list_dependencies(int argc, char *argv[], void *userdata) {
return log_error_errno(r, "Failed to expand names: %m"); return log_error_errno(r, "Failed to expand names: %m");
} }
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
STRV_FOREACH(u, units) { STRV_FOREACH(u, units) {
if (u != units) if (u != units)

View File

@ -73,7 +73,7 @@ static int output_jobs_list(sd_bus *bus, const struct job_info* jobs, unsigned n
return 0; return 0;
} }
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
table = table_new("job", "unit", "type", "state"); table = table_new("job", "unit", "type", "state");
if (!table) if (!table)
@ -168,7 +168,7 @@ int list_jobs(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return bus_log_parse_error(r); return bus_log_parse_error(r);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
return output_jobs_list(bus, jobs, c, skipped); return output_jobs_list(bus, jobs, c, skipped);
} }

View File

@ -232,7 +232,7 @@ int list_machines(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
typesafe_qsort(machine_infos, r, compare_machine_info); typesafe_qsort(machine_infos, r, compare_machine_info);
rc = output_machines_list(machine_infos, r); rc = output_machines_list(machine_infos, r);

View File

@ -255,7 +255,7 @@ int list_unit_files(int argc, char *argv[], void *userdata) {
return bus_log_parse_error(r); return bus_log_parse_error(r);
} }
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
typesafe_qsort(units, c, compare_unit_file_list); typesafe_qsort(units, c, compare_unit_file_list);
r = output_unit_file_list(units, c); r = output_unit_file_list(units, c);

View File

@ -221,7 +221,7 @@ int list_units(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
if (arg_with_dependencies) { if (arg_with_dependencies) {
_cleanup_strv_free_ char **names = NULL; _cleanup_strv_free_ char **names = NULL;
@ -439,7 +439,7 @@ int list_sockets(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = expand_unit_names(bus, strv_skip(argv, 1), ".socket", &sockets_with_suffix, NULL); r = expand_unit_names(bus, strv_skip(argv, 1), ".socket", &sockets_with_suffix, NULL);
if (r < 0) if (r < 0)
@ -703,7 +703,7 @@ int list_timers(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = expand_unit_names(bus, strv_skip(argv, 1), ".timer", &timers_with_suffix, NULL); r = expand_unit_names(bus, strv_skip(argv, 1), ".timer", &timers_with_suffix, NULL);
if (r < 0) if (r < 0)

View File

@ -36,7 +36,7 @@ int show_environment(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = bus_get_property(bus, bus_systemd_mgr, "Environment", &error, &reply, "as"); r = bus_get_property(bus, bus_systemd_mgr, "Environment", &error, &reply, "as");
if (r < 0) if (r < 0)

View File

@ -2036,7 +2036,7 @@ static int show_all(
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
c = (unsigned) r; c = (unsigned) r;
@ -2142,7 +2142,7 @@ int show(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
/* If no argument is specified inspect the manager itself */ /* If no argument is specified inspect the manager itself */
if (show_mode == SYSTEMCTL_SHOW_PROPERTIES && argc <= 1) if (show_mode == SYSTEMCTL_SHOW_PROPERTIES && argc <= 1)

View File

@ -128,7 +128,7 @@ static int systemctl_help(void) {
_cleanup_free_ char *link = NULL; _cleanup_free_ char *link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("systemctl", "1", &link); r = terminal_urlify_man("systemctl", "1", &link);
if (r < 0) if (r < 0)

View File

@ -1807,7 +1807,7 @@ static int cat_config(void) {
if (r < 0) if (r < 0)
return r; return r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
return cat_files(NULL, files, 0); return cat_files(NULL, files, 0);
} }

View File

@ -315,7 +315,7 @@ static int list_timezones(int argc, char **argv, void *userdata) {
if (r < 0) if (r < 0)
return bus_log_parse_error(r); return bus_log_parse_error(r);
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
strv_print(zones); strv_print(zones);
return 0; return 0;

View File

@ -3754,7 +3754,7 @@ static int run(int argc, char *argv[]) {
} }
if (arg_cat_config) { if (arg_cat_config) {
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
return cat_config(config_dirs, argv + optind); return cat_config(config_dirs, argv + optind);
} }

View File

@ -574,7 +574,7 @@ static int help(int argc, char *argv[], void *userdata) {
_cleanup_free_ char *link = NULL; _cleanup_free_ char *link = NULL;
int r; int r;
(void) pager_open(arg_pager_flags); pager_open(arg_pager_flags);
r = terminal_urlify_man("userdbctl", "1", &link); r = terminal_urlify_man("userdbctl", "1", &link);
if (r < 0) if (r < 0)