SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=format-security")
ENDIF(${CXX_FORMAT_SECURITY})
+INCLUDE(CheckFunctionExists)
+CHECK_FUNCTION_EXISTS(pipe2 PIPE2_FOUND)
+IF(${PIPE2_FOUND})
+ ADD_DEFINITIONS(-DHAVE_PIPE2)
+ENDIF(${PIPE2_FOUND})
+
ADD_DEFINITIONS( -D_FILE_OFFSET_BITS=64 )
ADD_DEFINITIONS( -DVERSION="${VERSION}" )
SET( LIBZYPP_VERSION_INFO "${LIBZYPP_SO_FIRST}.${LIBZYPP_AGE}.${LIBZYPP_PATCH}" )
EarlyPipe::EarlyPipe()
{
_fds[R] = _fds[W] = -1;
+#ifdef HAVE_PIPE2
::pipe2( _fds, O_NONBLOCK );
+#else
+ ::pipe( _fds );
+ ::fcntl(_fds[R], F_SETFD, O_NONBLOCK );
+ ::fcntl(_fds[W], F_SETFD, O_NONBLOCK );
+#endif
_stderr = ::fdopen( _fds[R], "r" );
}