}
arg_command = argv[optind++];
- if (!arg_command) {
- log_error("Command missing.");
- return -EINVAL;
- }
+ if (!arg_command)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Command missing.");
arg_syspath = argv[optind++];
- if (!arg_syspath) {
- log_error("syspath missing.");
- return -EINVAL;
- }
+ if (!arg_syspath)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "syspath missing.");
return 1;
}
int builtin_main(int argc, char *argv[], void *userdata) {
_cleanup_(sd_device_unrefp) sd_device *dev = NULL;
- enum udev_builtin_cmd cmd;
+ UdevBuiltinCommand cmd;
int r;
log_set_max_level(LOG_DEBUG);
r = udev_builtin_run(dev, cmd, arg_command, true);
if (r < 0)
- log_debug("error executing '%s', exit code %i", arg_command, r);
+ log_debug_errno(r, "Builtin command '%s' fails: %m", arg_command);
finish:
udev_builtin_exit();