summaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 61c87a1..75e702b 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -43,6 +43,7 @@
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
+#include <sys/wait.h>
#include "calcurse.h"
@@ -789,3 +790,18 @@ fork_exec (int *pfdin, int *pfdout, const char *path, char *const *arg)
}
return pid;
}
+
+/* Wait for a child process to terminate. */
+int
+child_wait (int *pfdin, int *pfdout, int pid)
+{
+ int stat;
+
+ if (pfdin)
+ close (*pfdin);
+ if (pfdout)
+ close (*pfdout);
+
+ waitpid (pid, &stat, 0);
+ return stat;
+}