Page MenuHomeFreeBSD

D56722.1795394981.diff
No OneTemporary

Authored By
Unknown
Size
615 B
Referenced Files
None
Subscribers
None

D56722.1795394981.diff

diff --git a/usr.bin/lockf/lockf.c b/usr.bin/lockf/lockf.c
--- a/usr.bin/lockf/lockf.c
+++ b/usr.bin/lockf/lockf.c
@@ -317,13 +317,15 @@
static int
acquire_lock(union lock_subject *subj, int flags, int silent)
{
- int fd;
+ int fd, lflags = LOCK_EX;
if (fdlock) {
+ if ((flags & O_NONBLOCK) == O_NONBLOCK)
+ lflags |= LOCK_NB;
assert(subj->subj_fd >= 0 && subj->subj_fd <= INT_MAX);
fd = (int)subj->subj_fd;
- if (flock(fd, LOCK_EX | LOCK_NB) == -1) {
+ if (flock(fd, lflags) == -1) {
if (errno == EAGAIN || errno == EINTR)
return (-1);
err(EX_CANTCREAT, "cannot lock fd %d", fd);

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 23, 12:49 AM (8 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41919306
Default Alt Text
D56722.1795394981.diff (615 B)

Event Timeline