diff options
author | Bernhard Kohl <bernhard.kohl@gmx.net> | 2010-09-06 17:06:02 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-09-08 12:39:19 +0200 |
commit | 05acda4d1660591ea317619699f6aa7c659a90f1 (patch) | |
tree | 2aab83078e4d10214ce0d636329fec701b5a4f59 /block | |
parent | ebef0bbb1a8b5420a50e887972cc6bf0d150f9b7 (diff) | |
download | hqemu-05acda4d1660591ea317619699f6aa7c659a90f1.zip hqemu-05acda4d1660591ea317619699f6aa7c659a90f1.tar.gz |
raw-posix: improve detection of scsi-generic devices
Allow symbolic links which point to /dev/sgX devices.
Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/raw-posix.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c index 0fce449..813372a 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -48,6 +48,7 @@ #endif #ifdef __linux__ #include <sys/ioctl.h> +#include <sys/param.h> #include <linux/cdrom.h> #include <linux/fd.h> #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 |