aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'block.c')
-rw-r--r--block.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/block.c b/block.c
index 3b35500b75..12fc2ef456 100644
--- a/block.c
+++ b/block.c
@@ -182,11 +182,17 @@ void get_tmp_filename(char *filename, int size)
#endif
#ifdef _WIN32
+static int is_windows_drive_prefix(const char *filename)
+{
+ return (((filename[0] >= 'a' && filename[0] <= 'z') ||
+ (filename[0] >= 'A' && filename[0] <= 'Z')) &&
+ filename[1] == ':');
+}
+
static int is_windows_drive(const char *filename)
{
- if (((filename[0] >= 'a' && filename[0] <= 'z') ||
- (filename[0] >= 'A' && filename[0] <= 'Z')) &&
- filename[1] == ':' && filename[2] == '\0')
+ if (is_windows_drive_prefix(filename) &&
+ filename[2] == '\0')
return 1;
if (strstart(filename, "\\\\.\\", NULL) ||
strstart(filename, "//./", NULL))
@@ -203,7 +209,8 @@ static BlockDriver *find_protocol(const char *filename)
const char *p;
#ifdef _WIN32
- if (is_windows_drive(filename))
+ if (is_windows_drive(filename) ||
+ is_windows_drive_prefix(filename))
return &bdrv_raw;
#endif
p = strchr(filename, ':');