oops. Fix indentation of the 'for' loop I just added.
This commit is contained in:
parent
f16d2ab2d3
commit
0e31b6b580
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=41711
@ -36,7 +36,7 @@
|
|||||||
static const char sccsid[] = "@(#)pw_util.c 8.3 (Berkeley) 4/2/94";
|
static const char sccsid[] = "@(#)pw_util.c 8.3 (Berkeley) 4/2/94";
|
||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: pw_util.c,v 1.11 1998/10/20 11:34:11 des Exp $";
|
"$Id: pw_util.c,v 1.12 1998/12/13 01:36:45 dillon Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -116,25 +116,25 @@ pw_lock()
|
|||||||
* Open should allow flock'ing the file; see 4.4BSD. XXX
|
* Open should allow flock'ing the file; see 4.4BSD. XXX
|
||||||
*/
|
*/
|
||||||
for (;;) {
|
for (;;) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
lockfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
|
lockfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
|
||||||
if (lockfd < 0 || fcntl(lockfd, F_SETFD, 1) == -1)
|
if (lockfd < 0 || fcntl(lockfd, F_SETFD, 1) == -1)
|
||||||
err(1, "%s", _PATH_MASTERPASSWD);
|
err(1, "%s", _PATH_MASTERPASSWD);
|
||||||
if (flock(lockfd, LOCK_EX|LOCK_NB))
|
if (flock(lockfd, LOCK_EX|LOCK_NB))
|
||||||
errx(1, "the password db file is busy");
|
errx(1, "the password db file is busy");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the password file was replaced while we were trying to
|
* If the password file was replaced while we were trying to
|
||||||
* get the lock, our hardlink count will be 0 and we have to
|
* get the lock, our hardlink count will be 0 and we have to
|
||||||
* close and retry.
|
* close and retry.
|
||||||
*/
|
*/
|
||||||
if (fstat(lockfd, &st) < 0)
|
if (fstat(lockfd, &st) < 0)
|
||||||
errx(1, "fstat() failed");
|
errx(1, "fstat() failed");
|
||||||
if (st.st_nlink != 0)
|
if (st.st_nlink != 0)
|
||||||
break;
|
break;
|
||||||
close(lockfd);
|
close(lockfd);
|
||||||
lockfd = -1;
|
lockfd = -1;
|
||||||
}
|
}
|
||||||
return (lockfd);
|
return (lockfd);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
static const char sccsid[] = "@(#)pw_util.c 8.3 (Berkeley) 4/2/94";
|
static const char sccsid[] = "@(#)pw_util.c 8.3 (Berkeley) 4/2/94";
|
||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: pw_util.c,v 1.11 1998/10/20 11:34:11 des Exp $";
|
"$Id: pw_util.c,v 1.12 1998/12/13 01:36:45 dillon Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -116,25 +116,25 @@ pw_lock()
|
|||||||
* Open should allow flock'ing the file; see 4.4BSD. XXX
|
* Open should allow flock'ing the file; see 4.4BSD. XXX
|
||||||
*/
|
*/
|
||||||
for (;;) {
|
for (;;) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
lockfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
|
lockfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
|
||||||
if (lockfd < 0 || fcntl(lockfd, F_SETFD, 1) == -1)
|
if (lockfd < 0 || fcntl(lockfd, F_SETFD, 1) == -1)
|
||||||
err(1, "%s", _PATH_MASTERPASSWD);
|
err(1, "%s", _PATH_MASTERPASSWD);
|
||||||
if (flock(lockfd, LOCK_EX|LOCK_NB))
|
if (flock(lockfd, LOCK_EX|LOCK_NB))
|
||||||
errx(1, "the password db file is busy");
|
errx(1, "the password db file is busy");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the password file was replaced while we were trying to
|
* If the password file was replaced while we were trying to
|
||||||
* get the lock, our hardlink count will be 0 and we have to
|
* get the lock, our hardlink count will be 0 and we have to
|
||||||
* close and retry.
|
* close and retry.
|
||||||
*/
|
*/
|
||||||
if (fstat(lockfd, &st) < 0)
|
if (fstat(lockfd, &st) < 0)
|
||||||
errx(1, "fstat() failed");
|
errx(1, "fstat() failed");
|
||||||
if (st.st_nlink != 0)
|
if (st.st_nlink != 0)
|
||||||
break;
|
break;
|
||||||
close(lockfd);
|
close(lockfd);
|
||||||
lockfd = -1;
|
lockfd = -1;
|
||||||
}
|
}
|
||||||
return (lockfd);
|
return (lockfd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user