aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block.c b/block.c
index 0fb188f763..8eeb51930f 100644
--- a/block.c
+++ b/block.c
@@ -198,14 +198,19 @@ static void bdrv_io_limits_intercept(BlockDriverState *bs,
/* check if the path starts with "<protocol>:" */
static int path_has_protocol(const char *path)
{
+ const char *p;
+
#ifdef _WIN32
if (is_windows_drive(path) ||
is_windows_drive_prefix(path)) {
return 0;
}
+ p = path + strcspn(path, ":/\\");
+#else
+ p = path + strcspn(path, ":/");
#endif
- return strchr(path, ':') != NULL;
+ return *p == ':';
}
int path_is_absolute(const char *path)