aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil/gr_util.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2012-12-27 14:09:50 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2012-12-27 14:09:50 +0000
commit98e79fb122f0aa6d7efd8af4cd338ea4b52e0dcf (patch)
tree59730ef56a5c93ebde101a13ff5a9c4b1109f4c4 /lib/libutil/gr_util.c
parenta68c6b5790ecd4aff7df0f01dbe54dc265a1de18 (diff)
Notes
Diffstat (limited to 'lib/libutil/gr_util.c')
-rw-r--r--lib/libutil/gr_util.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/libutil/gr_util.c b/lib/libutil/gr_util.c
index be343954f403..6bf102f3c4f3 100644
--- a/lib/libutil/gr_util.c
+++ b/lib/libutil/gr_util.c
@@ -106,10 +106,8 @@ gr_lock(void)
for (;;) {
struct stat st;
- lockfd = open(group_file, O_RDONLY, 0);
- if (lockfd < 0 || fcntl(lockfd, F_SETFD, 1) == -1)
- err(1, "%s", group_file);
- if (flock(lockfd, LOCK_EX|LOCK_NB) == -1) {
+ lockfd = flopen(group_file, O_RDONLY|O_NONBLOCK, 0);
+ if (lockfd == -1) {
if (errno == EWOULDBLOCK) {
errx(1, "the group file is busy");
} else {