From fdb896e577d4154b4dbd4350c9828e7df3b7da84 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 25 Feb 2014 23:04:55 +0000 Subject: Do not compile scsi ioctl decoding if is not available Add a generic test for availability to fix build with Bionic libc that does not provide . * 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 --- configure.ac | 1 + ioctl.c | 2 ++ scsi.c | 9 +++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 9b65d4b..db24349 100644 --- a/configure.ac +++ b/configure.ac @@ -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 e9a503d..3f6c410 100644 --- 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 ed5b3bb..c49f954 100644 --- a/scsi.c +++ b/scsi.c @@ -27,8 +27,11 @@ */ #include "defs.h" -#include -#include + +#ifdef HAVE_SCSI_SG_H + +# include +# include 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 */ -- cgit v1.2.3