pw.c (285415) | pw.c (285430) |
---|---|
1/*- 2 * Copyright (C) 1996 3 * David L. Nugent. 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 --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#ifndef lint 28static const char rcsid[] = | 1/*- 2 * Copyright (C) 1996 3 * David L. Nugent. 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 --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#ifndef lint 28static const char rcsid[] = |
29 "$FreeBSD: head/usr.sbin/pw/pw.c 285415 2015-07-12 00:02:43Z bapt $"; | 29 "$FreeBSD: head/usr.sbin/pw/pw.c 285430 2015-07-12 20:29:51Z bapt $"; |
30#endif /* not lint */ 31 32#include <err.h> 33#include <fcntl.h> 34#include <locale.h> 35#include <paths.h> 36#include <stdbool.h> 37#include <sys/wait.h> --- 93 unchanged lines hidden (view full) --- 131 { /* Request handlers */ 132 pw_user, 133 pw_group 134 }; 135 136 name = NULL; 137 relocated = nis = false; 138 memset(&conf, 0, sizeof(conf)); | 30#endif /* not lint */ 31 32#include <err.h> 33#include <fcntl.h> 34#include <locale.h> 35#include <paths.h> 36#include <stdbool.h> 37#include <sys/wait.h> --- 93 unchanged lines hidden (view full) --- 131 { /* Request handlers */ 132 pw_user, 133 pw_group 134 }; 135 136 name = NULL; 137 relocated = nis = false; 138 memset(&conf, 0, sizeof(conf)); |
139 strlcpy(conf.rootdir, "/", sizeof(conf.rootdir)); |
|
139 strlcpy(conf.etcpath, _PATH_PWD, sizeof(conf.etcpath)); 140 conf.fd = -1; 141 142 LIST_INIT(&arglist); 143 144 (void)setlocale(LC_ALL, ""); 145 146 /* --- 63 unchanged lines hidden (view full) --- 210 } 211 212 /* 213 * Bail out unless the user is specific! 214 */ 215 if (mode == -1 || which == -1) 216 cmdhelp(mode, which); 217 | 140 strlcpy(conf.etcpath, _PATH_PWD, sizeof(conf.etcpath)); 141 conf.fd = -1; 142 143 LIST_INIT(&arglist); 144 145 (void)setlocale(LC_ALL, ""); 146 147 /* --- 63 unchanged lines hidden (view full) --- 211 } 212 213 /* 214 * Bail out unless the user is specific! 215 */ 216 if (mode == -1 || which == -1) 217 cmdhelp(mode, which); 218 |
219 conf.rootfd = open(conf.rootdir, O_DIRECTORY|O_CLOEXEC); 220 if (conf.rootfd == -1) 221 errx(EXIT_FAILURE, "Unable to open '%s'", conf.rootdir); |
|
218 conf.which = which; 219 /* 220 * We know which mode we're in and what we're about to do, so now 221 * let's dispatch the remaining command line args in a genric way. 222 */ 223 optarg = NULL; 224 225 while ((ch = getopt(argc, argv, opts[which][mode])) != -1) { --- 383 unchanged lines hidden --- | 222 conf.which = which; 223 /* 224 * We know which mode we're in and what we're about to do, so now 225 * let's dispatch the remaining command line args in a genric way. 226 */ 227 optarg = NULL; 228 229 while ((ch = getopt(argc, argv, opts[which][mode])) != -1) { --- 383 unchanged lines hidden --- |