mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[client] common: fix time of check/time of use issue
This commit is contained in:
parent
9a53880b9b
commit
aa42751743
@ -149,15 +149,6 @@ bool ivshmemOpenDev(struct IVSHMEM * dev, const char * shmDevice)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct stat st;
|
||||
if (stat(shmDevice, &st) != 0)
|
||||
{
|
||||
DEBUG_ERROR("Failed to stat: %s", shmDevice);
|
||||
DEBUG_ERROR("%s", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
devSize = st.st_size;
|
||||
devFd = open(shmDevice, O_RDWR, (mode_t)0600);
|
||||
if (devFd < 0)
|
||||
{
|
||||
@ -166,6 +157,16 @@ bool ivshmemOpenDev(struct IVSHMEM * dev, const char * shmDevice)
|
||||
return false;
|
||||
}
|
||||
|
||||
struct stat st;
|
||||
if (fstat(devFd, &st) != 0)
|
||||
{
|
||||
DEBUG_ERROR("Failed to stat: %s", shmDevice);
|
||||
DEBUG_ERROR("%s", strerror(errno));
|
||||
close(devFd);
|
||||
return false;
|
||||
}
|
||||
|
||||
devSize = st.st_size;
|
||||
hasDMA = false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user