Page MenuHomeFreeBSD

D28240.id82579.diff
No OneTemporary

D28240.id82579.diff

diff --git a/bin/pwait/pwait.1 b/bin/pwait/pwait.1
--- a/bin/pwait/pwait.1
+++ b/bin/pwait/pwait.1
@@ -145,6 +145,10 @@
.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
--- a/bin/pwait/pwait.c
+++ b/bin/pwait/pwait.c
@@ -146,6 +146,10 @@
warnx("%s: bad process id", s);
continue;
}
+ if (pid == getpid()) {
+ warnx("%s: skip my own pid", s);
+ continue;
+ }
for (i = 0; i < nleft; i++) {
if (e[i].ident == (uintptr_t)pid) {
break;

File Metadata

Mime Type
text/plain
Expires
Sat, May 16, 9:16 PM (6 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33153495
Default Alt Text
D28240.id82579.diff (677 B)

Event Timeline