diff options
author | bapt <bapt@FreeBSD.org> | 2015-06-07 15:09:53 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-06-07 15:09:53 +0000 |
commit | 720254061f1395ebda3e3e2d6ebd2cf0d58f7249 (patch) | |
tree | 70656f0d609c1c16724f26a038105f3aacd18de2 /usr.sbin/pw/pw.c | |
parent | cdf878c88117d8f06ef98fd147fc94717bbdbcc6 (diff) | |
download | FreeBSD-src-720254061f1395ebda3e3e2d6ebd2cf0d58f7249.zip FreeBSD-src-720254061f1395ebda3e3e2d6ebd2cf0d58f7249.tar.gz |
Handle dryrun (-N) via global pwconf
Diffstat (limited to 'usr.sbin/pw/pw.c')
-rw-r--r-- | usr.sbin/pw/pw.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c index 991019d..7a86680 100644 --- a/usr.sbin/pw/pw.c +++ b/usr.sbin/pw/pw.c @@ -132,6 +132,7 @@ main(int argc, char *argv[]) relocated = nis = false; conf.rootdir[0] = '\0'; + conf.dryrun = false; strlcpy(conf.etcpath, _PATH_PWD, sizeof(conf.etcpath)); LIST_INIT(&arglist); @@ -218,6 +219,9 @@ main(int argc, char *argv[]) case 'C': config = optarg; break; + case 'N': + conf.dryrun = true; + break; case 'Y': nis = true; break; @@ -231,7 +235,7 @@ main(int argc, char *argv[]) /* * Must be root to attempt an update */ - if (geteuid() != 0 && mode != M_PRINT && mode != M_NEXT && getarg(&arglist, 'N')==NULL) + if (geteuid() != 0 && mode != M_PRINT && mode != M_NEXT && !conf.dryrun) errx(EX_NOPERM, "you must be root to run this program"); /* |