overhaul cancellation to fix resource leaks and dangerous behavior with signals
[musl] / src / process / waitid.c
index b1e5e9b..4fa7c02 100644 (file)
@@ -1,7 +1,13 @@
 #include <sys/wait.h>
 #include "syscall.h"
+#include "libc.h"
 
 int waitid(idtype_t type, id_t id, siginfo_t *info, int options)
 {
-       return syscall(SYS_waitid, type, id, info, options, 0);
+       int r;
+       CANCELPT_BEGIN;
+       r = syscall(SYS_waitid, type, id, info, options, 0);
+       if (r<0) CANCELPT_TRY;
+       CANCELPT_END;
+       return r;
 }