* flock.cc (fhandler_disk_file::lock): Don't test file open mode in
case of flock-type locks. Explain why.
This commit is contained in:
parent
2e0b52c9d8
commit
fc69f1aed5
|
@ -1,3 +1,8 @@
|
||||||
|
2009-03-12 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* flock.cc (fhandler_disk_file::lock): Don't test file open mode in
|
||||||
|
case of flock-type locks. Explain why.
|
||||||
|
|
||||||
2009-03-12 Brian Ford <Brian.Ford@FlightSafety.com>
|
2009-03-12 Brian Ford <Brian.Ford@FlightSafety.com>
|
||||||
|
|
||||||
* gethostby_helper: Fix typos in DEBUGGING case.
|
* gethostby_helper: Fix typos in DEBUGGING case.
|
||||||
|
|
|
@ -652,14 +652,19 @@ fhandler_disk_file::lock (int a_op, struct __flock64 *fl)
|
||||||
a_op = F_UNLCK;
|
a_op = F_UNLCK;
|
||||||
break;
|
break;
|
||||||
case F_RDLCK:
|
case F_RDLCK:
|
||||||
if (!(get_access () & GENERIC_READ))
|
/* flock semantics don't specify a requirement that the file has
|
||||||
|
been opened with a specific open mode, in contrast to POSIX locks
|
||||||
|
which require that a file is opened for reading to place a read
|
||||||
|
lock and opened for writing to place a write lock. */
|
||||||
|
if ((a_flags & F_POSIX) && !(get_access () & GENERIC_READ))
|
||||||
{
|
{
|
||||||
set_errno (EBADF);
|
set_errno (EBADF);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case F_WRLCK:
|
case F_WRLCK:
|
||||||
if (!(get_access () & GENERIC_WRITE))
|
/* See above comment. */
|
||||||
|
if ((a_flags & F_POSIX) && !(get_access () & GENERIC_WRITE))
|
||||||
{
|
{
|
||||||
set_errno (EBADF);
|
set_errno (EBADF);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue