In Windows spinup use CreteFile instead than FindFirst

It's just not possible to open the root dir with
FindFirstFile("C:\") or FindFirstFile("C:").
This commit is contained in:
Andrea Mazzoleni 2015-02-13 18:49:46 +01:00
parent f65ee373e5
commit 894cd5ee70

View file

@ -1874,17 +1874,12 @@ static void* thread_spinup(void* arg)
int f;
uint64_t start;
struct stat st;
char* slash;
start = tick_ms();
/* removes latest slash to make FindFirstFile() working */
slash = strrchr(devinfo->mount, '/');
if (slash)
*slash = 0;
/* uses lstat, as it maps to FindFirstFile */
if (lstat(devinfo->mount, &st) != 0) {
/* uses lstat_sync() that maps to CreateFile */
/* we cannot use FindFirstFile because it doesn't allow to open the root dir */
if (lstat_sync(devinfo->mount, &st, 0) != 0) {
/* LCOV_EXCL_START */
pthread_mutex_lock(&io_lock);
ferr("Failed to stat devinfo '%s'. %s.\n", devinfo->mount, strerror(errno));