# PHP-4.3.5 problem

- Thread: https://externals.io/message/8818
- Original archive: https://news-web.php.net/php.internals/8818
- Started by Phillip Porch on 2004-03-28T14:58:18+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #8818 — Phillip Porch — 2004-03-28T14:58:18+00:00

URL: https://externals.io/message/8818#8818

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
