From: Yu Watanabe Date: Wed, 2 Apr 2025 14:16:05 +0000 (+0900) Subject: udevadm-lock: use PidRef X-Git-Tag: v258-rc1~946^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7207bb026945cfafb9332d370b3aad4ec7739aae;p=thirdparty%2Fsystemd.git udevadm-lock: use PidRef --- diff --git a/src/udev/udevadm-lock.c b/src/udev/udevadm-lock.c index 78dd43ea458..9b495fda3c4 100644 --- a/src/udev/udevadm-lock.c +++ b/src/udev/udevadm-lock.c @@ -232,7 +232,6 @@ int lock_main(int argc, char *argv[], void *userdata) { _cleanup_free_ dev_t *devnos = NULL; size_t n_devnos = 0; usec_t deadline; - pid_t pid; int r; r = parse_argv(argc, argv); @@ -290,7 +289,11 @@ int lock_main(int argc, char *argv[], void *userdata) { /* Ignore SIGINT and allow the forked process to receive it */ (void) ignore_signals(SIGINT); - r = safe_fork("(lock)", FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGTERM|FORK_CLOSE_ALL_FDS|FORK_RLIMIT_NOFILE_SAFE|FORK_LOG, &pid); + _cleanup_(pidref_done) PidRef pidref = PIDREF_NULL; + r = pidref_safe_fork( + "(lock)", + FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGTERM|FORK_CLOSE_ALL_FDS|FORK_RLIMIT_NOFILE_SAFE|FORK_LOG, + &pidref); if (r < 0) return r; if (r == 0) { @@ -302,5 +305,5 @@ int lock_main(int argc, char *argv[], void *userdata) { _exit(EXIT_FAILURE); } - return wait_for_terminate_and_check(arg_cmdline[0], pid, 0); + return pidref_wait_for_terminate_and_check(arg_cmdline[0], &pidref, 0); }