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

Tim Robbins tjr at FreeBSD.ORG
Mon Apr 7 07:40:08 PDT 2003


The following reply was made to PR bin/50679; it has been noted by GNATS.

From: Tim Robbins <tjr at FreeBSD.ORG>
To: FreeBSD-gnats-submit at FreeBSD.org, freebsd-bugs at FreeBSD.org
Cc:  
Subject: Re: bin/50679: vi invoked from chpass and vipw exits on ^C
Date: Tue, 8 Apr 2003 00:35:31 +1000

 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