diff options
author | Michael Wallner <mike@php.net> | 2013-12-06 10:33:47 +0100 |
---|---|---|
committer | Michael Wallner <mike@php.net> | 2013-12-06 10:33:47 +0100 |
commit | 9ea2489f5c769e15eed3f637a82c7b304e0b79e8 (patch) | |
tree | 6a021e016af8b2aa60626151a5374682721db61a /main/streams/plain_wrapper.c | |
parent | f0248bdce598a382899056d348d204c9d61746df (diff) | |
parent | a48d82d23824a1d81e3ab847774476485f9388a5 (diff) | |
download | php-git-9ea2489f5c769e15eed3f637a82c7b304e0b79e8.tar.gz |
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
Fixed bug #61645 (fopen and O_NONBLOCK)
fix possibly uninitialized value
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r-- | main/streams/plain_wrapper.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 4dbf6889d7..c2ead6da4a 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -78,11 +78,7 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags) /* unknown mode */ return FAILURE; } -#if defined(O_NONBLOCK) - if (strchr(mode, 'n')) { - flags |= O_NONBLOCK; - } -#endif + if (strchr(mode, '+')) { flags |= O_RDWR; } else if (flags) { @@ -91,6 +87,12 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags) flags |= O_RDONLY; } +#if defined(O_NONBLOCK) + if (strchr(mode, 'n')) { + flags |= O_NONBLOCK; + } +#endif + #if defined(_O_TEXT) && defined(O_BINARY) if (strchr(mode, 't')) { flags |= _O_TEXT; |