[INTERPRETER]
* NEW: Don't use lockf and F_TLOCK if it does not exist. A workaround will have to be found! git-svn-id: svn://localhost/gambas/trunk@1214 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
ac3111a9eb
commit
7643ace3f5
1 changed files with 15 additions and 7 deletions
|
@ -929,13 +929,21 @@ void STREAM_lock(STREAM *stream)
|
|||
if (lseek(fd, 0, SEEK_SET) < 0)
|
||||
goto __ERROR;
|
||||
|
||||
if (lockf(fd, F_TLOCK, 0))
|
||||
{
|
||||
if (errno == EAGAIN)
|
||||
THROW(E_LOCK);
|
||||
else
|
||||
goto __ERROR;
|
||||
}
|
||||
#ifdef F_TLOCK
|
||||
|
||||
if (lockf(fd, F_TLOCK, 0))
|
||||
{
|
||||
if (errno == EAGAIN)
|
||||
THROW(E_LOCK);
|
||||
else
|
||||
goto __ERROR;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
fprintf(stderr, "locking is not implemented\n");
|
||||
|
||||
#endif
|
||||
|
||||
if (lseek(fd, pos, SEEK_SET) < 0)
|
||||
goto __ERROR;
|
||||
|
|
Loading…
Reference in a new issue