[osx] Properly handle 0 length on Windows implementation of flocking().
This commit is contained in:
parent
0e3125e59c
commit
89751336d2
4
osx.c
4
osx.c
|
@ -93,6 +93,10 @@ static int flocking(FILE *fh, int mode, __int64 ofs, __int64 len)
|
||||||
len = _filelengthi64(_fileno(fh));
|
len = _filelengthi64(_fileno(fh));
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
len -= ofs;
|
||||||
|
if (len < 0)
|
||||||
|
len = 0;
|
||||||
if (len > LONG_MAX) {
|
if (len > LONG_MAX) {
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Reference in New Issue