From: Tilghman Lesher Date: Mon, 23 Apr 2012 16:02:28 +0000 (+0000) Subject: On some platforms, O_RDONLY is not a flag to be checked, but merely the absence of... X-Git-Tag: 1.8.13.0-rc1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=233b8364d3238fcaf3306968cd68dac6246265f2;p=thirdparty%2Fasterisk.git On some platforms, O_RDONLY is not a flag to be checked, but merely the absence of O_RDWR and O_WRONLY. The POSIX specification does not mandate how these 3 flags must be specified, only that one of the three must be specified in every call. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@363209 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/astfd.c b/main/astfd.c index 90ded390f7..8aead62fd2 100644 --- a/main/astfd.c +++ b/main/astfd.c @@ -95,7 +95,11 @@ int __ast_fdleak_open(const char *file, int line, const char *func, const char * flags & O_NONBLOCK ? "|O_NONBLOCK" : "", flags & O_TRUNC ? "|O_TRUNC" : "", flags & O_RDWR ? "|O_RDWR" : "", +#if O_RDONLY == 0 + !(flags & (O_WRONLY | O_RDWR)) ? "|O_RDONLY" : "", +#else flags & O_RDONLY ? "|O_RDONLY" : "", +#endif flags & O_WRONLY ? "|O_WRONLY" : "", ""); flags &= ~(O_CREAT | O_APPEND | O_EXCL | O_NONBLOCK | O_TRUNC | O_RDWR | O_RDONLY | O_WRONLY);