--- embedaddon/php/main/streams/plain_wrapper.c 2013/07/22 01:32:11 1.1.1.3 +++ embedaddon/php/main/streams/plain_wrapper.c 2014/06/15 20:04:01 1.1.1.4 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: plain_wrapper.c,v 1.1.1.3 2013/07/22 01:32:11 misho Exp $ */ +/* $Id: plain_wrapper.c,v 1.1.1.4 2014/06/15 20:04:01 misho Exp $ */ #include "php.h" #include "php_globals.h" @@ -78,11 +78,7 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mo /* 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) { @@ -90,6 +86,12 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mo } else { 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')) {