]> granicus.if.org Git - strace/commitdiff
Do not compile scsi ioctl decoding if <scsi/sg.h> is not available
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 25 Feb 2014 23:04:55 +0000 (23:04 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 25 Feb 2014 23:15:20 +0000 (23:15 +0000)
Add a generic test for <scsi/sg.h> availability to fix build with
Bionic libc that does not provide <scsi/sg.h>.

* configure.ac (AC_CHECK_HEADERS): Add scsi/sg.h.
* ioctl.c (ioctl_decode): Do not call scsi_ioctl if !HAVE_SCSI_SG_H.
* scsi.c: Do not compile scsi ioctl decoding if !HAVE_SCSI_SG_H.

Reported-by: Elliott Hughes <enh@google.com>
configure.ac
ioctl.c
scsi.c

index 9b65d4b43d1d7f6a5b674d99229bd4cdec25713e..db24349e53c22a99e671b3a8b60e914cd9c3c8c2 100644 (file)
@@ -220,6 +220,7 @@ AC_CHECK_HEADERS(m4_normalize([
        mqueue.h
        netinet/sctp.h
        poll.h
+       scsi/sg.h
        stropts.h
        sys/acl.h
        sys/asynch.h
diff --git a/ioctl.c b/ioctl.c
index e9a503da7d5bff0d19548ff29ea966155992eea5..3f6c410b652eca90ae2de45808f2f7ac9cba8eb7 100644 (file)
--- a/ioctl.c
+++ b/ioctl.c
@@ -86,8 +86,10 @@ ioctl_decode(struct tcb *tcp, long code, long arg)
        case 0x03:
        case 0x12:
                return block_ioctl(tcp, code, arg);
+#ifdef HAVE_SCSI_SG_H
        case 0x22:
                return scsi_ioctl(tcp, code, arg);
+#endif
        case 'L':
                return loop_ioctl(tcp, code, arg);
        case 'M':
diff --git a/scsi.c b/scsi.c
index ed5b3bbcda587638965b2663108478e1d46e5dfd..c49f9548b037aeefcd4bfe5af700909aa1717e7f 100644 (file)
--- a/scsi.c
+++ b/scsi.c
  */
 
 #include "defs.h"
-#include <sys/ioctl.h>
-#include <scsi/sg.h>
+
+#ifdef HAVE_SCSI_SG_H
+
+# include <sys/ioctl.h>
+# include <scsi/sg.h>
 
 static const struct xlat sg_io_dxfer_direction[] = {
        XLAT(SG_DXFER_NONE),
@@ -137,3 +140,5 @@ scsi_ioctl(struct tcb *tcp, long code, long arg)
        }
        return 1;
 }
+
+#endif /* HAVE_SCSI_SG_H */