On some platforms, O_RDONLY is not a flag to be checked, but merely the absence of...
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 23 Apr 2012 16:08:33 +0000 (16:08 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 23 Apr 2012 16:08:33 +0000 (16:08 +0000)
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.
........

Merged revisions 363209 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 363212 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363215 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/astfd.c

index 90ded39..8aead62 100644 (file)
@@ -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" : "",
                                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" : "",
                                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);
                                flags & O_WRONLY ? "|O_WRONLY" : "",
                                "");
                        flags &= ~(O_CREAT | O_APPEND | O_EXCL | O_NONBLOCK | O_TRUNC | O_RDWR | O_RDONLY | O_WRONLY);