Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18707 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3235 invoked by uid 1010); 8 Sep 2005 11:00:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 3220 invoked from network); 8 Sep 2005 11:00:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Sep 2005 11:00:52 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:47831] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 47/BD-23233-2E910234 for ; Thu, 08 Sep 2005 07:00:52 -0400 Received: (qmail 10771 invoked from network); 8 Sep 2005 11:00:45 -0000 Received: from unknown (HELO gibraltar.zend.office) (10.1.2.137) by internal.zend.office with SMTP; 8 Sep 2005 11:00:45 -0000 Received: by gibraltar.zend.office (Postfix, from userid 660) id E94C8333B9; Thu, 8 Sep 2005 14:00:46 +0300 (IDT) Date: Thu, 8 Sep 2005 14:00:46 +0300 To: internals@lists.php.net Message-ID: <20050908110046.GA26085@gibraltar.zend.office> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="CE+1k2dSO48ffgeK" Content-Disposition: inline Organization: Zend Technologies User-Agent: Mutt/1.5.6i Subject: auto-disable seekable flag From: michael@zend.com (Michael Spector) --CE+1k2dSO48ffgeK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I've encountered change in following code behaviour (somewhere between 5.1.0b3 and 5.1.0-HEAD): posix_isatty (STDOUT); Now it produces this warning: cannot seek on a pipe The attached patch adds PHP_STREAM_FLAG_NO_SEEK to the stream flags, if it detects whether the file descriptor is not seekable. Thanks. -- Best regards, Michael --CE+1k2dSO48ffgeK Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="detect_seekable.diff" --- main/streams/plain_wrapper.c.orig 2005-09-08 13:43:52.000000000 +0300 +++ main/streams/plain_wrapper.c 2005-09-08 13:46:39.000000000 +0300 @@ -209,12 +209,15 @@ stream->flags |= PHP_STREAM_FLAG_NO_SEEK; } else { stream->position = lseek(self->fd, 0, SEEK_CUR); + if (stream->position == (off_t)-1) { #ifdef ESPIPE - if (stream->position == (off_t)-1 && errno == ESPIPE) { - stream->position = 0; - self->is_pipe = 1; - } + if (errno == ESPIPE) { + stream->position = 0; + self->is_pipe = 1; + } #endif + stream->flags |= PHP_STREAM_FLAG_NO_SEEK; + } } } --CE+1k2dSO48ffgeK--