When processing list of units (either provided manually or as a
wildcard), let's skip units for which we don't have an on-disk
counterpart, but note the -ENOENT error code and propagate it back to
the user.
Fixes: #14082
char **name;
sd_bus *bus;
bool first = true;
- int r;
+ int r, rc = 0;
/* Include all units by default — i.e. continue as if the --all
* option was used */
}
if (r < 0)
return r;
- if (r == 0)
- return -ENOENT;
+ if (r == 0) {
+ /* Skip units which have no on-disk counterpart, but
+ * propagate the error to the user */
+ rc = -ENOENT;
+ continue;
+ }
if (first)
first = false;
return r;
}
- return 0;
+ return rc;
}
static int set_property(int argc, char *argv[], void *userdata) {