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>
#endif
#ifdef __linux__
#include <sys/ioctl.h>
+#include <sys/param.h>
#include <linux/cdrom.h>
#include <linux/fd.h>
#endif
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