udevadm: Propagate return code from verb result

udevadm lock did not propagate the return code from the child process
because all positive values were treated as success.

v2:
Now 'udevadm test-builtin' ignores all positive return values from the
builtin commands. Otherwise, as the hwdb builtin returns an positive value
when a matching entry found, 'udevadm test-builtin hwdb' will fail.

v3:
Initialize partition table before calling 'sfdisk --delete'.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
This commit is contained in:
Joakim Nohlgård
2023-12-30 05:26:59 +09:00
committed by Yu Watanabe
co-authored by Yu Watanabe
parent 6b9cac874c
commit ba340e2a75
3 changed files with 10 additions and 2 deletions
+4 -1
View File
@@ -104,9 +104,12 @@ int builtin_main(int argc, char *argv[], void *userdata) {
}
r = udev_builtin_run(event, cmd, arg_command, true);
if (r < 0)
if (r < 0) {
log_debug_errno(r, "Builtin command '%s' fails: %m", arg_command);
goto finish;
}
r = 0;
finish:
udev_builtin_exit();
return r;
+1 -1
View File
@@ -137,4 +137,4 @@ static int run(int argc, char *argv[]) {
return udevadm_main(argc, argv);
}
DEFINE_MAIN_FUNCTION(run);
DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);