ref: 2af9a1e3d10677c2aca1d798b2df4dd8044c258b
parent: ffb8bab440e45d12b12064720d7fbffbedbc0cb3
author: Diego Elio Pettenò <flameeyes@flameeyes.eu>
date: Wed Feb 27 02:52:56 EST 2013
build: use an alternative method for making O_BINARY use conditional. Instead of creating a new mode altogether, check for the definition of O_BINARY in the headers, and if missing define it to zero. Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
--- a/configure.ac
+++ b/configure.ac
@@ -52,11 +52,25 @@
AC_C_INLINE
AC_TYPE_SIZE_T
-AC_CHECK_HEADERS(unistd.h sys/param.h sys/uio.h limits.h pwd.h errno.h)
+AC_CHECK_HEADERS([unistd.h sys/param.h sys/uio.h limits.h pwd.h]dnl
+ [errno.h sys/types.h sys/stat.h fcntl.h io.h])
+AC_CHECK_DECL([O_BINARY], [],
+ [AC_DEFINE([O_BINARY], [0], [Define O_BINARY if missing])],
+ [
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #if HAVE_SYS_STAT_H
+ # include <sys/stat.h>
+ #endif
+ #if HAVE_FCNTL_H
+ # include <fcntl.h>
+ #endif
+ ])
+
AC_SYS_LARGEFILE
-AC_CHECK_HEADERS([sys/stat.h sys/types.h io.h])
AC_CACHE_CHECK(
[for posix mkdir()],
[css_cv_mkdir_posix], [
--- a/src/device.c
+++ b/src/device.c
@@ -480,7 +480,7 @@
*****************************************************************************/
static int libc_open ( dvdcss_t dvdcss, char const *psz_device )
{
- dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, LIBC_OPEN_MODE );
+ dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY );
if( dvdcss->i_fd == -1 )
{
--- a/src/device.h
+++ b/src/device.h
@@ -46,9 +46,6 @@
#if !defined(WIN32) && !defined(__OS2__)
# define DVDCSS_RAW_OPEN
-# define LIBC_OPEN_MODE 0
-#else
-# define LIBC_OPEN_MODE O_BINARY
#endif