Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22592 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32707 invoked by uid 1010); 27 Mar 2006 11:23:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 32692 invoked from network); 27 Mar 2006 11:23:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2006 11:23:44 -0000 X-Host-Fingerprint: 66.249.82.196 xproxy.gmail.com Linux 2.4/2.6 Received: from ([66.249.82.196:11628] helo=xproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id C2/7E-37235-F3BC7244 for ; Mon, 27 Mar 2006 06:23:43 -0500 Received: by xproxy.gmail.com with SMTP id t14so895547wxc for ; Mon, 27 Mar 2006 03:23:40 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:mime-version:content-type; b=D3ea71ngarrmxo1KdOSidcMF/pH+njiOnTgsWh+xQ0VSnZE+c9C4NY1p/WnX2OKJRfjW4sTn4z+Nq/TMyKeBYR/d2/Vxw3x19ftgL4uLcD8KT5KAKHzH+jLZmVhhxvQ9E8+yqeSX9iAfzmqlpVFeTm2pqHdBFKoHaYO/u0uN6TE= Received: by 10.70.87.2 with SMTP id k2mr4314653wxb; Mon, 27 Mar 2006 03:23:39 -0800 (PST) Received: by 10.70.15.5 with HTTP; Mon, 27 Mar 2006 03:23:39 -0800 (PST) Message-ID: <7f3ed2c30603270323v720385e9va5bb9e03102abbcb@mail.gmail.com> Date: Mon, 27 Mar 2006 13:23:39 +0200 Sender: hannes.magnusson@gmail.com To: internals@lists.php.net MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_524_13870743.1143458619809" Subject: [PATCH] Make streams respect POSIX error retrieval functions (bug #36868) From: bjori@php.net ("Hannes Magnusson") ------=_Part_524_13870743.1143458619809 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi all Attached is a patch (against HEAD) to allow codes like: $fp =3D @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 ------=_Part_524_13870743.1143458619809 Content-Type: text/plain; name=posix.patch.txt; charset=us-ascii Content-Transfer-Encoding: 7bit X-Attachment-Id: f_elapork3 Content-Disposition: attachment; filename="posix.patch.txt" 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 #include #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 { ------=_Part_524_13870743.1143458619809--