Page MenuHomeFreeBSD

D56722.diff
No OneTemporary

D56722.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
@@ -320,10 +320,14 @@
int fd;
if (fdlock) {
+ int lflags = LOCK_EX;
+
assert(subj->subj_fd >= 0 && subj->subj_fd <= INT_MAX);
fd = (int)subj->subj_fd;
- if (flock(fd, LOCK_EX | LOCK_NB) == -1) {
+ if ((flags & O_NONBLOCK) == O_NONBLOCK)
+ lflags |= LOCK_NB;
+ 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
Sun, Jul 19, 4:13 PM (15 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32656040
Default Alt Text
D56722.diff (536 B)

Event Timeline