--- a/gdbsupport/job-control.cc
+++ b/gdbsupport/job-control.cc
@@ -48,7 +48,7 @@ gdb_setpgid ()
       /* The call setpgid (0, 0) is supposed to work and mean the same
 	 thing as this, but on Ultrix 4.2A it fails with EPERM (and
 	 setpgid (getpid (), getpid ()) succeeds).  */
-      retval = setpgid (getpid (), getpid ());
+      retval = setpgid (0, 0);
 #else
 #ifdef HAVE_SETPGRP
 #ifdef SETPGRP_VOID
