stat() doesn't work with devices on Windows, so move check for '\\.\' earlier.
authorBruce Cran <bruce@cran.org.uk>
Wed, 22 Feb 2012 17:55:16 +0000 (17:55 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 22 Feb 2012 19:32:38 +0000 (20:32 +0100)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c

index cf5ec8e95585ffd004c95d3ff4f2e1188aee2ec6..446eeaf0801a2772470bb2a47cde0c5368a67d70 100644 (file)
@@ -926,10 +926,13 @@ static void get_file_type(struct fio_file *f)
        else
                f->filetype = FIO_TYPE_FILE;
 
        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)) {
        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;
                        f->filetype = FIO_TYPE_BD;
                else if (S_ISCHR(sb.st_mode))
                        f->filetype = FIO_TYPE_CHAR;