tree-wide: propagate error code from _from_string() functions
Now that we know we have something useful, no need to make an answer up.
This commit is contained in:
@@ -30,9 +30,9 @@ static int log_setting_internal(sd_bus *bus, const BusLocator* bloc, const char
|
||||
|
||||
if (value) {
|
||||
if (level) {
|
||||
if (log_level_from_string(value) < 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"\"%s\" is not a valid log level.", value);
|
||||
r = log_level_from_string(value);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "\"%s\" is not a valid log level.", value);
|
||||
}
|
||||
|
||||
r = bus_set_property(bus, bloc,
|
||||
|
||||
@@ -2040,8 +2040,7 @@ int show(int argc, char *argv[], void *userdata) {
|
||||
|
||||
show_mode = systemctl_show_mode_from_string(argv[0]);
|
||||
if (show_mode < 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Invalid argument.");
|
||||
return log_error_errno(show_mode, "Invalid argument.");
|
||||
|
||||
if (show_mode == SYSTEMCTL_SHOW_HELP && argc <= 1)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
|
||||
@@ -143,7 +143,7 @@ int get_state_one_unit(sd_bus *bus, const char *unit, UnitActiveState *ret_activ
|
||||
|
||||
state = unit_active_state_from_string(buf);
|
||||
if (state < 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid unit state '%s' for: %s", buf, unit);
|
||||
return log_error_errno(state, "Invalid unit state '%s' for: %s", buf, unit);
|
||||
|
||||
*ret_active_state = state;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user