From: Bruce Cran Date: Wed, 22 Feb 2012 17:55:16 +0000 (+0000) Subject: stat() doesn't work with devices on Windows, so move check for '\\.\' earlier. X-Git-Tag: fio-2.0.4~7 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=3892182aff21486d9c38a346fe8681c9098ecb0c stat() doesn't work with devices on Windows, so move check for '\\.\' earlier. Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index cf5ec8e9..446eeaf0 100644 --- a/filesetup.c +++ b/filesetup.c @@ -926,10 +926,13 @@ static void get_file_type(struct fio_file *f) else f->filetype = FIO_TYPE_FILE; + /* \\.\ is the device namespace in Windows, where every file is + * a block device */ + if (strncmp(f->file_name, "\\\\.\\", 4) == 0) + f->filetype = FIO_TYPE_BD; + if (!stat(f->file_name, &sb)) { - /* \\.\ is the device namespace in Windows, where every file is - * a block device */ - if (S_ISBLK(sb.st_mode) || strncmp(f->file_name, "\\\\.\\", 4) == 0) + if (S_ISBLK(sb.st_mode)) f->filetype = FIO_TYPE_BD; else if (S_ISCHR(sb.st_mode)) f->filetype = FIO_TYPE_CHAR;