diff options
author | Richard Phibel <rphibel@googlemail.com> | 2022-11-07 17:13:15 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-01-10 15:16:26 +0100 |
commit | cd48e23f6a33c9acb47a06b99d9bdc84ee42cebe (patch) | |
tree | 4c241fe4081efeb70aa6b33ff9a7613b2b0b2720 /src/systemctl | |
parent | 81315baa68c9c8f7f6f5608fa8bc1daebf0618df (diff) | |
download | systemd-cd48e23f6a33c9acb47a06b99d9bdc84ee42cebe.tar.gz |
core: add OpenFile setting
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl-show.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c index f78cf307ca..4166b361dd 100644 --- a/src/systemctl/systemctl-show.c +++ b/src/systemctl/systemctl-show.c @@ -23,6 +23,7 @@ #include "locale-util.h" #include "memory-util.h" #include "numa-util.h" +#include "open-file.h" #include "parse-util.h" #include "path-util.h" #include "pretty-print.h" @@ -1858,6 +1859,38 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m return bus_log_parse_error(r); return 1; + } else if (contents[0] == SD_BUS_TYPE_STRUCT_BEGIN && streq(name, "OpenFile")) { + char *path, *fdname; + uint64_t offlags; + + r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(sst)"); + if (r < 0) + return bus_log_parse_error(r); + + while ((r = sd_bus_message_read(m, "(sst)", &path, &fdname, &offlags)) > 0) { + _cleanup_free_ char *ofs = NULL; + + r = open_file_to_string( + &(OpenFile){ + .path = path, + .fdname = fdname, + .flags = offlags, + }, + &ofs); + if (r < 0) + return log_error_errno( + r, "Failed to convert OpenFile= value to string: %m"); + + bus_print_property_value(name, expected_value, flags, ofs); + } + if (r < 0) + return bus_log_parse_error(r); + + r = sd_bus_message_exit_container(m); + if (r < 0) + return bus_log_parse_error(r); + + return 1; } break; |