php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62188 Possible typo in errno check in dio_fdopen()
Submitted: 2012-05-30 09:34 UTC Modified: 2012-06-30 22:57 UTC
From: daniel dot mueller at inexio dot net Assigned: cyberspice (profile)
Status: Closed Package: dio (PECL)
PHP Version: Irrelevant OS: FreeBSD 7.2
Private report: No CVE-ID: None
 [2012-05-30 09:34 UTC] daniel dot mueller at inexio dot net
Description:
------------
In dio_fdopen() the errno is checked against "EBADFD".

The effect is following:

1) Compile under FreeBSD fails, because this macro doesn't exist.

2) Under Linux there  are two Macros:
 #define	EBADFD		77	/* File descriptor in bad state */
 #define	EBADF		 9	/* Bad file number */

 The check has probally not the desired effect in the case of a bad file number.


I have added a patch, which checks against "EBADF" insteat of "EBADFD"

This affects Version 0.0.5 of the dio extension.
 





   


Test script:
---------------
<?php

var_dump(dio_fdopen(-1));


Expected result:
----------------
Warning: dio_fdopen(): Bad file descriptor -1 in /home/dm/dio-test.php on line 5
bool(false)


Actual result:
--------------
FreeBSD: compile of extension fails.

Linux:
resource(4) of type (Direct I/O File Descriptor)

Patches

patch-error-checking.diff (last revision 2012-05-30 09:35 UTC by daniel dot mueller at inexio dot net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-12 00:31 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: cyberspice
 [2012-06-30 22:57 UTC] cyberspice@php.net
Fixed in 0.0.6
 [2012-06-30 22:57 UTC] cyberspice@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 14:01:30 2024 UTC