From 8451e720d89838ea322ccc628b4fb0505fc48eb0 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 25 Dec 2023 19:51:43 +0100 Subject: [PATCH] systemctl: use SYNTHETIC_ERRNO() --- src/systemctl/systemctl-edit.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c index a6bb5e52892..c851c8546ef 100644 --- a/src/systemctl/systemctl-edit.c +++ b/src/systemctl/systemctl-edit.c @@ -247,13 +247,12 @@ static int find_paths_to_edit( return r; /* Already logged by unit_find_paths() */ if (!path) { - if (!arg_force) { - log_info("Run 'systemctl edit%s --force --full %s' to create a new unit.", - arg_runtime_scope == RUNTIME_SCOPE_GLOBAL ? " --global" : - arg_runtime_scope == RUNTIME_SCOPE_USER ? " --user" : "", - *name); - return -ENOENT; - } + if (!arg_force) + return log_info_errno(SYNTHETIC_ERRNO(ENOENT), + "Run 'systemctl edit%s --force --full %s' to create a new unit.", + arg_runtime_scope == RUNTIME_SCOPE_GLOBAL ? " --global" : + arg_runtime_scope == RUNTIME_SCOPE_USER ? " --user" : "", + *name); /* Create a new unit from scratch */ r = unit_file_create_new( -- 2.47.3