summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-09-16 09:58:24 +0000
committersabetts <sabetts>2001-09-16 09:58:24 +0000
commit4b68178c380e2d3d9915bb2993b90cf5ab9c6be9 (patch)
tree046c34c166f0d7162945a53a71c78476af154787
parentbb0c4b008d37b49d76476aa79d1968f40c800e4a (diff)
downloadratpoison-4b68178c380e2d3d9915bb2993b90cf5ab9c6be9.zip
* configure.in: check for setpgrp.
* src/actions.c (spawn): if setpgid doesn't exist, try setpgrp.
-rw-r--r--ChangeLog8
-rw-r--r--configure.in4
-rw-r--r--src/actions.c7
3 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index fe08445..00596d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-2001-09-15 shawn <sabetts@diggin.lamenet.tmp>
+2001-09-16 shawn <sabetts@diggin.lamenet.tmp>
+
+ * configure.in: check for setpgrp.
+
+ * src/actions.c (spawn): Only call setsid if it exists.
+ (spawn): Only call setpgid if it exists.
+ (spawn): if setpgid doesn't exist, try setpgrp.
* configure.in: check for setsid and setpgid functions. Add
contrib/Makefile to AC_OUTPUT.
diff --git a/configure.in b/configure.in
index cb5c90c..5a6c41b 100644
--- a/configure.in
+++ b/configure.in
@@ -17,7 +17,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl $Id: configure.in,v 1.22 2001/09/16 09:48:43 sabetts Exp $
+dnl $Id: configure.in,v 1.23 2001/09/16 09:58:24 sabetts Exp $
AC_INIT(src/main.c)
AM_INIT_AUTOMAKE(ratpoison, 1.0.1-cvs)
@@ -74,7 +74,7 @@ AC_CHECK_HEADERS(unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
-AC_CHECK_FUNCS(getopt getopt_long setsid setpgid)
+AC_CHECK_FUNCS(getopt getopt_long setsid setpgid setpgrp)
AC_TYPE_SIGNAL
AC_OUTPUT(Makefile doc/Makefile src/Makefile contrib/Makefile)
diff --git a/src/actions.c b/src/actions.c
index 41d0149..8468f16 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -864,9 +864,14 @@ spawn(void *data)
/* Some process setup to make sure the spawned process runs
in its own session. */
putenv(DisplayString(dpy));
+#ifdef HAVE_SETSID
setsid();
+#endif
+#if defined (HAVE_SETPGID)
setpgid (0, 0);
-
+#elif defined (HAVE_SETPGRP)
+ setpgrp (0, 0);
+#endif
execl("/bin/sh", "sh", "-c", cmd, 0);
_exit(EXIT_FAILURE);
}