Ticket #3141 (closed bug: fixed)

Opened 16 months ago

Last modified 14 months ago

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: Platform: All
Blocking:

Description

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

 http://www.kernel.org/doc/man-pages/online/pages/man2/flock.2.html

or NetBSD

 http://www.daemon-systems.org/man/flock.2.html

Attachments

flock-bug.c Download (0.5 KB) - added by bhaible 16 months ago.
test case
haiku-flock-bug.png Download (1.9 KB) - added by bhaible 16 months ago.

Change History

Changed 16 months ago by bhaible

test case

Changed 16 months ago by bhaible

Changed 16 months ago by karmak

  • cc olive@… added

Changed 14 months ago by axeld

Thanks! The bug is gone with r28889.

Changed 14 months ago by axeld

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.