]> Sergey Matveev's repositories - bfs.git/blobdiff - src/bfstd.c
bfstd: New xwaitpid() wrapper
[bfs.git] / src / bfstd.c
index eee02b8d6f0c73275dbcca5cdc5e82b3dd18d031..06226a256f635b6d5ca79aafc1f99cbbbabb9abf 100644 (file)
@@ -20,6 +20,7 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <unistd.h>
 #include <wchar.h>
 #include <wctype.h>
@@ -391,6 +392,14 @@ int xminor(dev_t dev) {
 #endif
 }
 
+pid_t xwaitpid(pid_t pid, int *status, int flags) {
+       pid_t ret;
+       do {
+               ret = waitpid(pid, status, flags);
+       } while (ret < 0 && errno == EINTR);
+       return ret;
+}
+
 int dup_cloexec(int fd) {
 #ifdef F_DUPFD_CLOEXEC
        return fcntl(fd, F_DUPFD_CLOEXEC, 0);