[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    [PHP-DEV] PHP-4.3.5 problem
From:       Phillip Porch <root () theporch ! com>
Date:       2004-03-28 14:58:18
Message-ID: Pine.SC5.4.58.0403280854100.2111 () sco ! theporch ! com
[Download RAW message or body]

There seems to be a problem in the streams.c code. There is a line that
has the construct

#if defined(S_ISFIFO) || defined(S_ISSOCK)

the problem is the the code below assumes that S_ISSOCK is defined but the
if statement is true if either S_ISFIFO or S_ISSOCK is defined. If you
have a system (like I do) that defines S_ISFIFO but not S_ISSOCK, the code
fails. I looked at the PHP-4.3.4 code and munged the code as per the patch
below to make it compile. Someone might want to look at this further.

Thanks,


*** streams.c Tue Mar 16 17:23:25 2004
--- streams.c.new Sun Mar 28 08:06:00 2004
***************
*** 2016,2022 ****
  {
  	php_stdio_stream_data *self;
  	php_stream *stream;
! #if defined(S_ISFIFO) || defined(S_ISSOCK)
  	struct stat sb;
  	int stat_ok;

--- 2016,2022 ----
  {
  	php_stdio_stream_data *self;
  	php_stream *stream;
! #if defined(S_ISFIFO) && defined(S_ISSOCK)
  	struct stat sb;
  	int stat_ok;

***************
*** 2037,2044 ****

  #ifdef S_ISFIFO
  	/* detect if this is a pipe */
! 	if (stat_ok) {
! 		self->is_pipe = S_ISFIFO(sb.st_mode) ? 1 : 0;
  	}
  #elif defined(PHP_WIN32)
  	{
--- 2037,2045 ----

  #ifdef S_ISFIFO
  	/* detect if this is a pipe */
! 	if (self->fd >= 0) {
! 		struct stat sb;
! 		self->is_pipe = (fstat(self->fd, &sb) == 0 && S_ISFIFO(sb.st_mode)) ? 1 : 0;
  	}
  #elif defined(PHP_WIN32)
  	{

-- 
Phillip P. Porch <root@sco.theporch.com>  NIC:PP1573     finger for
http://www.theporch.com    36 1.187 N     86 44.018 W     GnuPG key

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic