summaryrefslogtreecommitdiff
path: root/editors/jed/files/patch-src_unix.c
blob: c567e6d14229381ab9e0c043e2546a39d91b9a00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- src/unix.c
+++ src/unix.c
@@ -211,8 +211,19 @@ static void set_process_group (void)
      {
 	pid_t pid = getpid ();
 	Startup_PGID = getpgid (pid);
-	(void) tcsetpgrp (Read_FD, pid);
-	(void) setpgid (pid, pid);
+	if (-1 == tcsetpgrp (Read_FD, pid))
+	  {
+	     fprintf (stderr, "tcsetpgrp failed\n");
+	     Terminal_PGID = -1;
+	     return;
+	  }
+	if (-1 == setpgid (pid, pid))
+	  {
+	     fprintf (stderr, "setpgid failed\n");
+	     (void) tcsetpgrp (Read_FD, Startup_PGID);
+	     Terminal_PGID = -1;
+	     return;
+	  }
      }
 #endif
 }