From e8edf4e1cf6051802ad717dcf8a454d4661929af Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Wed, 7 Aug 2013 08:25:51 -0300 Subject: [PATCH 1/2] cmdutils: Only do the windows-specific commandline parsing on _WIN32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes commandline parsing on Cygwin (on 64 bit, and on very recent 32 bit), where the configure check does find the CommandLineToArgvW function (since it exists in the link libraries and in the headers), but whose GetCommandLineW() only returns the application's path. (This is due to a cygwin internal optimization, see http://cygwin.com/ml/cygwin/2013-07/msg00538.html for details.) Arguments are only given through main's argc/argv, and they're already UTF-8. Signed-off-by: Martin Storsjö --- cmdutils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmdutils.c b/cmdutils.c index 8e43795191..062d7ec2f8 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -182,7 +182,10 @@ static const OptionDef *find_option(const OptionDef *po, const char *name) return po; } -#if HAVE_COMMANDLINETOARGVW +/* _WIN32 means using the windows libc - cygwin doesn't define that + * by default. HAVE_COMMANDLINETOARGVW is true on cygwin, while + * it doesn't provide the actual command line via GetCommandLineW(). */ +#if HAVE_COMMANDLINETOARGVW && defined(_WIN32) #include #include /* Will be leaked on exit */ From 0f1fb6c0194c85483dedb93b20a5b76f6fc9d520 Mon Sep 17 00:00:00 2001 From: Derek Buitenhuis Date: Wed, 7 Aug 2013 19:44:37 -0400 Subject: [PATCH 2/2] libavutil: Don't use fcntl if the function does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not all platforms have the function. Signed-off-by: Derek Buitenhuis Signed-off-by: Martin Storsjö --- libavutil/file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/file.c b/libavutil/file.c index add049d24b..9ce0dc5e01 100644 --- a/libavutil/file.c +++ b/libavutil/file.c @@ -52,8 +52,11 @@ int avpriv_open(const char *filename, int flags, ...) #endif fd = open(filename, flags, mode); +#if HAVE_FCNTL if (fd != -1) fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif + return fd; }