From: Ivan Shapovalov Date: Wed, 17 Jul 2024 08:50:27 +0000 (+0200) Subject: systemctl: cat: do not exit(1) on missing units if `--force` X-Git-Tag: v257-rc1~555^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b498f250b25c4f7d93cdf257de140e150c7a1ba7;p=thirdparty%2Fsystemd.git systemctl: cat: do not exit(1) on missing units if `--force` We are eating the error message if `--force` is set, so do not return a non-zero exit code either. --- diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c index b7bd3851fd0..880bd4d742e 100644 --- a/src/systemctl/systemctl-edit.c +++ b/src/systemctl/systemctl-edit.c @@ -69,8 +69,9 @@ int verb_cat(int argc, char *argv[], void *userdata) { return r; if (r == 0) { /* Skip units which have no on-disk counterpart, but propagate the error to the - * user */ - rc = -ENOENT; + * user (if --force is set, eat the error, just like unit_find_paths()) */ + if (!arg_force) + rc = -ENOENT; continue; }