Re: [PATCH] Check the return value of do_fstat() to avoid error conditions.
| From: | Joshua Rogers | Date: | Tue, 27 Jan 2015 03:32:09 +0000 |
| Subject: | Re: [PATCH] Check the return value of do_fstat() to avoid error conditions. | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81195@lists.php.net to get a copy of this message | ||
On 27/01/15 11:39, Joshua Rogers wrote:
> if(do_fstat(data, 1)<0) {
> return -1;
> }
This was wrong, anyways.
if '1' is returned, the it is OK to continue.
If '0' is returned, it is not OK to continue(return -1)
Since this is the case, should the do_fstat function be changed to a
boolean?
It is only possible for it to return 0 and 1:
> d->cached_fstat = r == 0;
>
> return r;
> }
> return 0;
It makes it confusing when reading the code that it is defined as an
int, but the output can only be 0/1.
Does anybody object to me changing to from a 'static int', to a 'static
zend_bool'?
I'll submit a PR, but I would be interested in feedback via the mailing
list.
Thanks,
--
-- Joshua Rogers <https://internot.info/>
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc