+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
* might not be our child. */
SET_FOREACH(p, pids, i) {
- /* We misuse getpgid as a check whether a
- * process still exists. */
- if (getpgid(PTR_TO_PID(p)) >= 0)
+ /* kill(pid, 0) sends no signal, but it tells
+ * us whether the process still exists. */
+ if (kill(PTR_TO_PID(p), 0) == 0)
continue;
if (errno != ESRCH)