mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
In fileLock, take in account the case where the file cannot be opened
overity issue 23352
This commit is contained in:
parent
c71b4cc896
commit
1e4adc512e
@ -1219,14 +1219,17 @@ int fileLock(const char * lock_file)
|
||||
int fd = -1;
|
||||
#if defined(HAVE_LOCKF)
|
||||
fd = open(lock_file, O_CREAT|O_APPEND|O_SYNC|O_RDWR, 0666);
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
if (lockf(fd, F_LOCK, 0) != 0) {
|
||||
close(fd);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
return(fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
void fileUnlock(int fd, const char * /* lock_file*/)
|
||||
{
|
||||
#if defined(HAVE_LOCKF)
|
||||
|
Loading…
Reference in New Issue
Block a user