Opened 11 years ago

Closed 11 years ago

#3141 closed bug (fixed)

flock does not check the operation argument for validity

Reported by: bhaible Owned by: axeld
Priority: normal Milestone: R1
Component: System/Kernel Version: R1/pre-alpha1
Keywords: Cc: olive@…
Blocked By: Blocking:
Has a Patch: no Platform: All


The flock() function does not return an error code when the operation argument is invalid. In the attached sample program a shared and exclusive lock is requested - obviously nonsense, but the BeOS implementation does not reject it.

Expected output: -1 and the value of EINVAL Actual output: 0 0

flock() is not specified by POSIX, therefore one has to look at the manual pages of some systems, such as Linux

or NetBSD

Attachments (2)

flock-bug.c (560 bytes ) - added by bhaible 11 years ago.
test case
haiku-flock-bug.png (1.9 KB ) - added by bhaible 11 years ago.

Download all attachments as: .zip

Change History (5)

by bhaible, 11 years ago

Attachment: flock-bug.c added

test case

by bhaible, 11 years ago

Attachment: haiku-flock-bug.png added

comment:1 by karmak, 11 years ago

Cc: olive@… added

comment:2 by axeld, 11 years ago

Thanks! The bug is gone with hrev28889.

comment:3 by axeld, 11 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.