wez             Fri Nov 28 17:48:32 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/main       streams.c 
  Log:
  Probable fix for #25575; STDIN/STDOUT/STDERR streams not registered
  as network sockets when PHP run from x?inetd.
  
  
Index: php-src/main/streams.c
diff -u php-src/main/streams.c:1.125.2.84 php-src/main/streams.c:1.125.2.85
--- php-src/main/streams.c:1.125.2.84   Fri Nov 28 17:11:34 2003
+++ php-src/main/streams.c      Fri Nov 28 17:48:31 2003
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.125.2.84 2003/11/28 22:11:34 wez Exp $ */
+/* $Id: streams.c,v 1.125.2.85 2003/11/28 22:48:31 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -2016,6 +2016,16 @@
 {
        php_stdio_stream_data *self;
        php_stream *stream;
+#if defined(S_ISFIFO) || defined(S_ISSOCK)
+       struct stat sb;
+       int stat_ok;
+
+       stat_ok = fd >= 0 && fstat(fd, &sb) == 0;
+
+       if (stat_ok && S_ISSOCK(sb.st_mode)) {
+               return _php_stream_sock_open_from_socket(fd, persistent_id STREAMS_CC 
TSRMLS_CC);
+       }
+#endif
 
        self = pemalloc_rel_orig(sizeof(*self), persistent_id);
        memset(self, 0, sizeof(*self));
@@ -2027,9 +2037,8 @@
 
 #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;
+       if (stat_ok) {
+               self->is_pipe = S_ISFIFO(sb.st_mode) ? 1 : 0;
        }
 #elif defined(PHP_WIN32)
        {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to