Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10312 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53050 invoked by uid 1010); 8 Jun 2004 10:51:59 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 52968 invoked from network); 8 Jun 2004 10:51:59 -0000 Received: from unknown (HELO bs.webdmz.tv2.dk) (193.88.88.129) by pb1.pair.com with SMTP; 8 Jun 2004 10:51:59 -0000 Received: from npi43f76a.tv2.local (unknown [10.10.102.175]) by bs.webdmz.tv2.dk (Postfix) with ESMTP id 2D4282A96B9; Tue, 8 Jun 2004 12:51:37 +0200 (CEST) To: Alexander Valyalkin Cc: internals@lists.php.net In-Reply-To: References: <5.1.0.14.2.20040607170659.01f2fc08@127.0.0.1> <20040607200254.2f3fab48.tony2001@phpclub.net> Content-Type: text/plain Message-ID: <1086691893.2138.3.camel@mopo.tv2i.dk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 08 Jun 2004 12:51:33 +0200 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] readfile() improvements From: morten-VxKok5x5@afdelingp.dk ("Morten K. Poulsen") On Tue, 2004-06-08 at 11:32, Alexander Valyalkin wrote: > + /* get the length of local file connected to descriptor fd */ > fstat(fd, &sbuf); [snip] > + if (errno) { Oh-oh! You need to check the return value of fstat(). Errno is only set if fstat() fails (returns -1), otherwise errno keeps its old (junk) value. Best regards, Morten -- Morten K. Poulsen