#include "nsterm.h"
#endif
-#ifdef HAVE_SETPGID
-#if !defined (USG)
-#undef setpgrp
-#define setpgrp setpgid
-#endif
-#endif
-
/* Pattern used by call-process-region to make temp files. */
static Lisp_Object Vtemp_file_name_pattern;
{
if (fd[0] >= 0)
emacs_close (fd[0]);
+
#ifdef HAVE_SETSID
setsid ();
-#endif
-#if defined (USG)
- setpgrp ();
#else
- setpgrp (pid, pid);
-#endif /* USG */
+ setpgid (0, 0);
+#endif
/* Emacs ignores SIGPIPE, but the child should not. */
signal (SIGPIPE, SIG_DFL);
if (err != in && err != out)
emacs_close (err);
-#if defined (USG)
-#ifndef SETPGRP_RELEASES_CTTY
- setpgrp (); /* No arguments but equivalent in this case */
+#if defined HAVE_SETPGID || ! (defined USG && defined SETPGRP_RELEASES_CTTY)
+ setpgid (pid, pid);
#endif
-#else /* not USG */
- setpgrp (pid, pid);
-#endif /* not USG */
/* setpgrp_of_tty is incorrect here; it uses input_fd. */
tcsetpgrp (0, pid);