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.
This commit is contained in:
Ivan Shapovalov
2024-09-05 10:08:03 +09:00
committed by Yu Watanabe
parent 1306567a40
commit b498f250b2
+3 -2
View File
@@ -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;
}