bin/50679: vi invoked from chpass and vipw exits on ^C

Tim Robbins tjr at FreeBSD.ORG
Mon Apr 7 07:35:30 PDT 2003


Possible patch:

Index: pw_util.c
===================================================================
RCS file: /home/ncvs/src/lib/libutil/pw_util.c,v
retrieving revision 1.28
diff -U10 -p -r1.28 pw_util.c
--- pw_util.c	17 Mar 2003 02:12:55 -0000	1.28
+++ pw_util.c	7 Apr 2003 13:41:01 -0000
@@ -315,20 +315,22 @@ pw_edit(int notsetuid)
 			_exit(EXIT_FAILURE);
 		}
 		errno = 0;
 		execl(_PATH_BSHELL, "sh", "-c", editcmd, NULL);
 		free(editcmd);
 		_exit(errno);
 	default:
 		/* parent */
 		break;
 	}
+	setpgid(editpid, editpid);
+	tcsetpgrp(1, editpid);
 	for (;;) {
 		editpid = waitpid(editpid, &pstat, WUNTRACED);
 		if (editpid == -1) {
 			unlink(tempname);
 			return (-1);
 		} else if (WIFSTOPPED(pstat)) {
 			raise(WSTOPSIG(pstat));
 		} else if (WIFEXITED(pstat) && WEXITSTATUS(pstat) == 0) {
 			editpid = -1;
 			break;


More information about the freebsd-bugs mailing list