diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/pwait/pwait.1 | 6 | ||||
-rw-r--r-- | bin/pwait/pwait.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/bin/pwait/pwait.1 b/bin/pwait/pwait.1 index 0452203eb4a1..b9b651bfc905 100644 --- a/bin/pwait/pwait.1 +++ b/bin/pwait/pwait.1 @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2020 +.Dd January 21, 2021 .Dt PWAIT 1 .Os .Sh NAME @@ -145,6 +145,10 @@ is not a substitute for the .Xr wait 1 builtin as it will not clean up any zombies or state in the parent process. +.Pp +To avoid deadlock, +.Nm +will ignore its own pid, if it is provided as a process id to wait for. .Sh HISTORY A .Nm diff --git a/bin/pwait/pwait.c b/bin/pwait/pwait.c index f39922b48eb9..85cc6b994acf 100644 --- a/bin/pwait/pwait.c +++ b/bin/pwait/pwait.c @@ -146,6 +146,10 @@ main(int argc, char *argv[]) warnx("%s: bad process id", s); continue; } + if (pid == getpid()) { + warnx("%s: skiping my own pid", s); + continue; + } for (i = 0; i < nleft; i++) { if (e[i].ident == (uintptr_t)pid) { break; |