List Archive

Thread

Thread Index

Message

From: Benjamin Gilbert <bgilbert%backtick.net@localhost>
To: libzip-discuss%nih.at@localhost
Subject: Re: MinGW-w64 build failure with 1.3.1 and 1.3.2
Date: Mon, 20 Nov 2017 07:11:29 -0500

On Mon, Nov 20, 2017 at 7:07 AM, Thomas Klausner <tk%giga.or.at@localhost> wrote:
On Mon, Nov 20, 2017 at 06:53:31AM -0500, Benjamin Gilbert wrote:
> libzip 1.3.1 and 1.3.2 fail to build with MinGW-w64:
>
> nonrandomopentest.c: In function 'main':
> nonrandomopentest.c:51:39: error: macro "open" requires 3 arguments, but
> only 2 given
>      fd = open("/dev/urandom", O_RDONLY);

This looks like a problem in MinGW. POSIX defines open like this:

int open(const char *path, int oflag, ...)

i.e. two arguments are required, more are allowed.

True.  However, compat.h defines open like this:

#if defined(HAVE__OPEN)
#define open(a, b, c)   _open((a), (b))
#endif

--Benjamin Gilbert

Made by MHonArc.