Date: Sat, 17 Oct 1998 00:11:57 -0500 (EST) From: ajk@purdue.edu To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/8353: vipw and chpass echo bogus error messages Message-ID: <199810170511.AAA25288@poynting.physics.purdue.edu>
next in thread | raw e-mail | index | archive | help
>Number: 8353
>Category: bin
>Synopsis: vipw and chpass echo bogus error messages
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Oct 16 22:20:01 PDT 1998
>Last-Modified:
>Originator: Andrew J. Korty
>Organization:
Purdue University Physics Department
>Release: FreeBSD 3.0-BETA i386
>Environment:
FreeBSD volta.physics.purdue.edu 3.0-BETA FreeBSD 3.0-BETA #3:
Tue Oct 13 15:04:20 EST 1998
csg@volta.physics.purdue.edu:/usr/src/sys/compile/VOLTA i386
>Description:
A call to vfork() was replaced by a call to fork() in pw_util.c
recently. Later, warn() is called in the parent process, expecting
it to have remained intact from the execlp() called in the child.
>How-To-Repeat:
env EDITOR=/nonexistent vipw
>Fix:
One possible solution:
*** src/usr.sbin/pw_util.c.orig 1998/10/13 14:52:33 1.10
--- src/usr.sbin/pw_util.c 1998/10/17 04:37:49
***************
*** 44,49 ****
--- 44,50 ----
* and passwd(1).
*/
+ #include <sys/errno.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/resource.h>
***************
*** 185,200 ****
(void)setgid(getgid());
(void)setuid(getuid());
}
execlp(editor, p, tempname, NULL);
! _exit(1);
}
for (;;) {
editpid = waitpid(editpid, (int *)&pstat, WUNTRACED);
if (editpid == -1)
pw_error(editor, 1, 1);
else if (WIFSTOPPED(pstat))
raise(WSTOPSIG(pstat));
! else if (WIFEXITED(pstat) && WEXITSTATUS(pstat) == 0)
break;
else
pw_error(editor, 1, 1);
--- 186,203 ----
(void)setgid(getgid());
(void)setuid(getuid());
}
+ errno = 0;
execlp(editor, p, tempname, NULL);
! _exit(errno);
}
for (;;) {
editpid = waitpid(editpid, (int *)&pstat, WUNTRACED);
+ errno = WEXITSTATUS(pstat);
if (editpid == -1)
pw_error(editor, 1, 1);
else if (WIFSTOPPED(pstat))
raise(WSTOPSIG(pstat));
! else if (WIFEXITED(pstat) && errno == 0)
break;
else
pw_error(editor, 1, 1);
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810170511.AAA25288>
