]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: use SYNTHETIC_ERRNO() 30633/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 25 Dec 2023 18:51:43 +0000 (19:51 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 25 Dec 2023 18:51:43 +0000 (19:51 +0100)
src/systemctl/systemctl-edit.c

index a6bb5e52892252b28fb561b7e2cbb7d18ef5cfbc..c851c8546ef55c51caba46780ace0ff5bce9d6d9 100644 (file)
@@ -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(