summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/cvs/util.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index f9d0f689c85..f70b19d4f95 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.10 2004/08/13 12:48:51 jfb Exp $ */
+/* $OpenBSD: util.c,v 1.11 2004/11/09 21:08:05 krapht Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -81,6 +81,8 @@ static const char *cvs_modestr[8] = {
+pid_t cvs_exec_pid;
+
/*
* cvs_readrepo()
@@ -523,3 +525,28 @@ cvs_mkadmin(struct cvs_file *cdir, mode_t mode)
return (0);
}
+
+
+/*
+ * cvs_exec()
+ */
+
+int
+cvs_exec(int argc, char **argv, int fds[3])
+{
+ int ret;
+ pid_t pid;
+
+ if ((pid = fork()) == -1) {
+ cvs_log(LP_ERRNO, "failed to fork");
+ return (-1);
+ } else if (pid == 0) {
+ execvp(argv[0], argv);
+ err(1, "failed to exec %s", argv[0]);
+ }
+
+ if (waitpid(pid, &ret, 0) == -1)
+ warn("failed to waitpid");
+
+ return (ret);
+}