sasha           Sun Apr 15 11:42:51 2001 EDT

  Modified files:              
    /php4/ext/standard  file.c 
  Log:
  We shoud not fseek in a pipe and this caused a problem with popen and
  fgets on the platforms where the buffer fix was applied (Solaris, FreeBSD).
  Now the fseek is done only when the handle is of type fopen.
  
  
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.150 php4/ext/standard/file.c:1.151
--- php4/ext/standard/file.c:1.150      Sat Apr  7 14:46:43 2001
+++ php4/ext/standard/file.c    Sun Apr 15 11:42:50 2001
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.150 2001/04/07 21:46:43 sniper Exp $ */
+/* $Id: file.c,v 1.151 2001/04/15 18:42:50 sasha Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -921,7 +921,7 @@
        /* needed because recv doesnt put a null at the end*/
        memset(buf,0,len+1);
 #ifdef HAVE_FLUSHIO
-       if (!issock) {
+       if (type == le_fopen) {
                fseek((FILE*)what, 0, SEEK_CUR);
        }
 #endif
@@ -969,7 +969,7 @@
        }
 
 #ifdef HAVE_FLUSHIO
-       if (!issock) {
+       if (type == le_fopen) {
                fseek((FILE*)what, 0, SEEK_CUR);
        }
 #endif
@@ -1172,7 +1172,9 @@
                ret = SOCK_WRITEL((*arg2)->value.str.val,num_bytes,socketd);
        } else {
 #ifdef HAVE_FLUSHIO
-               fseek((FILE*)what, 0, SEEK_CUR);
+               if (type == le_fopen) {
+                       fseek((FILE*)what, 0, SEEK_CUR);
+               }
 #endif
                ret = fwrite((*arg2)->value.str.val,1,num_bytes,(FILE*)what);
        }
@@ -1814,7 +1816,9 @@
        
        if (!issock) {
 #ifdef HAVE_FLUSHIO
-               fseek((FILE*)what, 0, SEEK_CUR);
+               if (type == le_fopen)
+                       fseek((FILE*)what, 0, SEEK_CUR);
+               }
 #endif
                return_value->value.str.len = fread(return_value->value.str.val, 1, 
len, (FILE*)what);
                return_value->value.str.val[return_value->value.str.len] = 0;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to