From: Bernhard Kohl Date: Mon, 6 Sep 2010 15:06:02 +0000 (+0200) Subject: raw-posix: improve detection of scsi-generic devices X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=05acda4d1660591ea317619699f6aa7c659a90f1;p=qemu-xen-4.1-testing.git raw-posix: improve detection of scsi-generic devices Allow symbolic links which point to /dev/sgX devices. Signed-off-by: Bernhard Kohl Signed-off-by: Kevin Wolf --- diff --git a/block/raw-posix.c b/block/raw-posix.c index 0fce44909..813372a6c 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -48,6 +48,7 @@ #endif #ifdef __linux__ #include +#include #include #include #endif @@ -868,8 +869,13 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) s->type = FTYPE_FILE; #if defined(__linux__) - if (strstart(filename, "/dev/sg", NULL)) { - bs->sg = 1; + { + char resolved_path[ MAXPATHLEN ], *temp; + + temp = realpath(filename, resolved_path); + if (temp && strstart(temp, "/dev/sg", NULL)) { + bs->sg = 1; + } } #endif