Deleted Added
full compact
pw_util.c (75821) pw_util.c (79452)
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 22 unchanged lines hidden (view full) ---

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static const char sccsid[] = "@(#)pw_util.c 8.3 (Berkeley) 4/2/94";
37#endif
38static const char rcsid[] =
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 22 unchanged lines hidden (view full) ---

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static const char sccsid[] = "@(#)pw_util.c 8.3 (Berkeley) 4/2/94";
37#endif
38static const char rcsid[] =
39 "$FreeBSD: head/lib/libutil/pw_util.c 75821 2001-04-22 03:00:09Z dd $";
39 "$FreeBSD: head/lib/libutil/pw_util.c 79452 2001-07-09 09:24:06Z brian $";
40#endif /* not lint */
41
42/*
43 * This file is used by all the "password" programs; vipw(8), chpass(1),
44 * and passwd(1).
45 */
46
47#include <sys/param.h>

--- 121 unchanged lines hidden (view full) ---

169 int pstat;
170 pid_t pid;
171
172 (void)fflush(stderr);
173 if (!(pid = fork())) {
174 if(!username) {
175 warnx("rebuilding the database...");
176 execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-d", mppath,
40#endif /* not lint */
41
42/*
43 * This file is used by all the "password" programs; vipw(8), chpass(1),
44 * and passwd(1).
45 */
46
47#include <sys/param.h>

--- 121 unchanged lines hidden (view full) ---

169 int pstat;
170 pid_t pid;
171
172 (void)fflush(stderr);
173 if (!(pid = fork())) {
174 if(!username) {
175 warnx("rebuilding the database...");
176 execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-d", mppath,
177 tempname, NULL);
177 tempname, (char *)NULL);
178 } else {
179 warnx("updating the database...");
180 execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-d", mppath,
178 } else {
179 warnx("updating the database...");
180 execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-d", mppath,
181 "-u", username, tempname, NULL);
181 "-u", username, tempname, (char *)NULL);
182 }
183 pw_error(_PATH_PWD_MKDB, 1, 1);
184 }
185 pid = waitpid(pid, &pstat, 0);
186 if (pid == -1 || !WIFEXITED(pstat) || WEXITSTATUS(pstat) != 0)
187 return (0);
188 warnx("done");
189 return (1);

--- 14 unchanged lines hidden (view full) ---

204 p = editor;
205
206 if (!(editpid = fork())) {
207 if (notsetuid) {
208 (void)setgid(getgid());
209 (void)setuid(getuid());
210 }
211 errno = 0;
182 }
183 pw_error(_PATH_PWD_MKDB, 1, 1);
184 }
185 pid = waitpid(pid, &pstat, 0);
186 if (pid == -1 || !WIFEXITED(pstat) || WEXITSTATUS(pstat) != 0)
187 return (0);
188 warnx("done");
189 return (1);

--- 14 unchanged lines hidden (view full) ---

204 p = editor;
205
206 if (!(editpid = fork())) {
207 if (notsetuid) {
208 (void)setgid(getgid());
209 (void)setuid(getuid());
210 }
211 errno = 0;
212 execlp(editor, p, tempname, NULL);
212 execlp(editor, p, tempname, (char *)NULL);
213 _exit(errno);
214 }
215 for (;;) {
216 editpid = waitpid(editpid, (int *)&pstat, WUNTRACED);
217 errno = WEXITSTATUS(pstat);
218 if (editpid == -1)
219 pw_error(editor, 1, 1);
220 else if (WIFSTOPPED(pstat))

--- 46 unchanged lines hidden ---
213 _exit(errno);
214 }
215 for (;;) {
216 editpid = waitpid(editpid, (int *)&pstat, WUNTRACED);
217 errno = WEXITSTATUS(pstat);
218 if (editpid == -1)
219 pw_error(editor, 1, 1);
220 else if (WIFSTOPPED(pstat))

--- 46 unchanged lines hidden ---