diff options
author | imp <imp@FreeBSD.org> | 2004-07-21 17:38:04 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2004-07-21 17:38:04 +0000 |
commit | 697fd69b851e325aff839d56bd1bda29af5b50f5 (patch) | |
tree | fda3fc992608d758e04a139ceeb5bd23c85a9792 /usr.sbin/pwd_mkdb/pwd_mkdb.c | |
parent | fc96a672a7a0b1968e7ace3d7393d759e113144a (diff) | |
download | FreeBSD-src-697fd69b851e325aff839d56bd1bda29af5b50f5.zip FreeBSD-src-697fd69b851e325aff839d56bd1bda29af5b50f5.tar.gz |
Add support for ignoring locking failures. This is only enabled when
you've specified a directory. It is intended to be used in building
custom releases over NFS where locking may be unreliable at best and
there is no contention that the locking is designed to arbitrate.
Other uses of this flag are discouraged. Document same in usage and
man page (including the warning about unwise).
Sponsored by: Timing Solutions
Diffstat (limited to 'usr.sbin/pwd_mkdb/pwd_mkdb.c')
-rw-r--r-- | usr.sbin/pwd_mkdb/pwd_mkdb.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index 5731aef..204a588 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -115,10 +115,10 @@ main(int argc, char *argv[]) char sbuf2[MAXPATHLEN]; char *username; u_int method, methoduid; - int Cflag; + int Cflag, dflag, iflag; int nblock = 0; - Cflag = 0; + iflag = dflag = Cflag = 0; strcpy(prefix, _PATH_PWD); makeold = 0; username = NULL; @@ -131,8 +131,12 @@ main(int argc, char *argv[]) nblock = LOCK_NB; /* will fail if locked */ break; case 'd': + dflag++; strlcpy(prefix, optarg, sizeof(prefix)); break; + case 'i': + iflag++; + break; case 'p': /* create V7 "file.orig" */ makeold = 1; break; @@ -184,7 +188,7 @@ main(int argc, char *argv[]) if (!(fp = fopen(pname, "r"))) error(pname); - if (flock(fileno(fp), LOCK_EX|nblock) < 0) + if (flock(fileno(fp), LOCK_EX|nblock) < 0 && !(dflag && iflag)) error("flock"); if (fstat(fileno(fp), &st) < 0) error(pname); @@ -752,6 +756,6 @@ usage() { (void)fprintf(stderr, -"usage: pwd_mkdb [-C] [-N] [-p] [-d <dest dir>] [-s <cachesize>] [-u <local username>] file\n"); +"usage: pwd_mkdb [-C] [-N] [-i] [-p] [-d <dest dir>] [-s <cachesize>] [-u <local username>] file\n"); exit(1); } |