Browse Source

sh: bad pgid when resetting?

K. Lange 3 years ago
parent
commit
c3b841d13c
2 changed files with 5 additions and 2 deletions
  1. 2 1
      apps/sh.c
  2. 3 1
      kernel/fs/tty.c

+ 2 - 1
apps/sh.c

@@ -1553,7 +1553,8 @@ int main(int argc, char ** argv) {
 
 	shell_interactive = 1;
 
-	my_pgid = getpgid(0);
+	setpgid(0,0);
+	my_pgid = getuid();
 	signal(SIGTTOU, SIG_IGN);
 	signal(SIGTTIN, SIG_IGN);
 

+ 3 - 1
kernel/fs/tty.c

@@ -276,7 +276,9 @@ int pty_ioctl(pty_t * pty, int request, void * argp) {
 			if (!argp) return -EINVAL;
 			validate(argp);
 			memcpy(&pty->size, argp, sizeof(struct winsize));
-			group_send_signal(pty->fg_proc, SIGWINCH, 1);
+			if (pty->fg_proc) {
+				group_send_signal(pty->fg_proc, SIGWINCH, 1);
+			}
 			return 0;
 		case TIOCGWINSZ:
 			if (!argp) return -EINVAL;