[PATCH] Make streams respect POSIX error retrieval functions (bug #36868)

From: Date: Mon, 27 Mar 2006 11:23:39 +0000
Subject: [PATCH] Make streams respect POSIX error retrieval functions (bug #36868)
Groups: php.internals 
Request: Send a blank email to internals+get-22592@lists.php.net to get a copy of this message
Hi all Attached is a patch (against HEAD) to allow codes like: $fp = @fopen("/unwritabledirectory/filename", "w"); if (!$fp) { printf("The errornr was: %d", posix_get_last_error()); } Fixes bug #36868 (If, for what ever reason, the patch doesn't come through: http://php.is/bugs/36868/posix.patch.txt ) - Hannes

Index: streams.c =================================================================== RCS file: /repository/php-src/main/streams/streams.c,v retrieving revision 1.114 diff -u -r1.114 streams.c --- streams.c 26 Mar 2006 06:19:24 -0000 1.114 +++ streams.c 27 Mar 2006 11:00:59 -0000 @@ -32,6 +32,10 @@ #include <stddef.h> #include <fcntl.h> #include "php_streams_int.h" +#if HAVE_POSIX +#include "ext/posix/php_posix.h" +ZEND_DECLARE_MODULE_GLOBALS(posix) +#endif /* {{{ resource and registration code */ /* Global wrapper hash, copied to FG(stream_wrappers) on registration of volatile wrapper */ @@ -164,6 +168,9 @@ free_msg = 1; } else { +#if HAVE_POSIX + POSIX_G(last_error) = errno; +#endif msg = strerror(errno); } } else {
« previous php.internals (#22592) next »