X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsystemctl%2Fsystemctl.c;h=d356686f78e482c23e3717c47d040e8212a4d0dd;hb=8b5e2af10830d55b2032e6c79d0cd1f959bb5b7f;hp=47b0aac03e75c950ef388369fc1d643824c61eb3;hpb=7d4fb3b1c5ec7a117bd5a36e4591819a64e00136;p=elogind.git diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 47b0aac03..d356686f7 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -73,7 +73,6 @@ #include "bus-message.h" #include "bus-error.h" #include "bus-errors.h" -#include "copy.h" #include "mkdir.h" static char **arg_types = NULL; @@ -3221,6 +3220,7 @@ typedef struct UnitStatusInfo { const char *active_state; const char *sub_state; const char *unit_file_state; + const char *unit_file_preset; const char *description; const char *following; @@ -3344,7 +3344,10 @@ static void print_status_info( if (i->load_error) printf(" Loaded: %s%s%s (Reason: %s)\n", on, strna(i->load_state), off, i->load_error); - else if (path && i->unit_file_state) + else if (path && !isempty(i->unit_file_state) && !isempty(i->unit_file_preset)) + printf(" Loaded: %s%s%s (%s; %s; vendor preset: %s)\n", + on, strna(i->load_state), off, path, i->unit_file_state, i->unit_file_preset); + else if (path && !isempty(i->unit_file_state)) printf(" Loaded: %s%s%s (%s; %s)\n", on, strna(i->load_state), off, path, i->unit_file_state); else if (path) @@ -3669,6 +3672,8 @@ static int status_property(const char *name, sd_bus_message *m, UnitStatusInfo * i->following = s; else if (streq(name, "UnitFileState")) i->unit_file_state = s; + else if (streq(name, "UnitFilePreset")) + i->unit_file_preset = s; else if (streq(name, "Result")) i->result = s; } @@ -5735,7 +5740,6 @@ static int unit_file_find_path(LookupPaths *lp, const char *unit_name, char **un } static int create_edit_temp_file(const char *new_path, const char *original_path, char **ret_tmp_fn) { - _cleanup_close_ int fd = -1; int r; char *t; @@ -5748,8 +5752,11 @@ static int create_edit_temp_file(const char *new_path, const char *original_path return log_oom(); r = mkdir_parents(new_path, 0755); - if (r < 0) - return log_error_errno(r, "Failed to create directories for %s: %m", new_path); + if (r < 0) { + log_error_errno(r, "Failed to create directories for %s: %m", new_path); + free(t); + return r; + } r = copy_file(original_path, t, 0, 0644); if (r == -ENOENT) {