Add a configure check for struct request_sense. Use this in
CDROM_ScsiPassThroughDir() and CDROM_ScsiPassThrough() to unbreak the
build on FreeBSD.
diff --git a/configure b/configure
index 160cd2c..c4c190b 100755
--- a/configure
+++ b/configure
@@ -17287,6 +17287,71 @@
fi
+echo "$as_me:$LINENO: checking for request_sense" >&5
+echo $ECHO_N "checking for request_sense... $ECHO_C" >&6
+if test "${ac_cv_type_request_sense+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <linux/cdrom.h>
+
+int
+main ()
+{
+if ((request_sense *) 0)
+ return 0;
+if (sizeof (request_sense))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_request_sense=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_request_sense=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_request_sense" >&5
+echo "${ECHO_T}$ac_cv_type_request_sense" >&6
+if test $ac_cv_type_request_sense = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_REQUEST_SENSE 1
+_ACEOF
+
+
+fi
+
echo "$as_me:$LINENO: checking whether linux/input.h is for real" >&5
echo $ECHO_N "checking whether linux/input.h is for real... $ECHO_C" >&6
diff --git a/configure.ac b/configure.ac
index 93d0fbd..aeb4844 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1246,6 +1246,7 @@
AC_C_INLINE
AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t, long long, fsblkcnt_t, fsfilcnt_t])
AC_CHECK_TYPES([sigset_t],,,[#include <signal.h>])
+AC_CHECK_TYPES([request_sense],,,[#include <linux/cdrom.h>])
AC_CACHE_CHECK([whether linux/input.h is for real],
wine_cv_linux_input_h,
diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c
index 67f006b..5b0c939 100644
--- a/dlls/ntdll/cdrom.c
+++ b/dlls/ntdll/cdrom.c
@@ -1427,10 +1427,11 @@
#ifdef SENSEBUFLEN
if (pPacket->SenseInfoLength > SENSEBUFLEN)
-#else
- if (pPacket->SenseInfoLength > sizeof(struct request_sense))
-#endif
return STATUS_INVALID_PARAMETER;
+#elif defined HAVE_REQUEST_SENSE
+ if (pPacket->SenseInfoLength > sizeof(struct request_sense))
+ return STATUS_INVALID_PARAMETER;
+#endif
if (pPacket->DataTransferLength > 0 && !pPacket->DataBuffer)
return STATUS_INVALID_PARAMETER;
@@ -1547,10 +1548,11 @@
#ifdef SENSEBUFLEN
if (pPacket->SenseInfoLength > SENSEBUFLEN)
-#else
- if (pPacket->SenseInfoLength > sizeof(struct request_sense))
-#endif
return STATUS_INVALID_PARAMETER;
+#elif defined HAVE_REQUEST_SENSE
+ if (pPacket->SenseInfoLength > sizeof(struct request_sense))
+ return STATUS_INVALID_PARAMETER;
+#endif
if (pPacket->DataTransferLength > 0 && pPacket->DataBufferOffset < sizeof(SCSI_PASS_THROUGH))
return STATUS_INVALID_PARAMETER;
diff --git a/include/config.h.in b/include/config.h.in
index 7b9ce70..beccaba 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -482,6 +482,9 @@
/* Define to 1 if you have the <regex.h> header file. */
#undef HAVE_REGEX_H
+/* Define to 1 if the system has the type `request_sense'. */
+#undef HAVE_REQUEST_SENSE
+
/* Define to 1 if you have the <resolv.h> header file. */
#undef HAVE_RESOLV_H