wez Thu Dec 19 15:34:34 2002 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/standard exec.c
/php4/main streams.c
Log:
MFH fix for bug #21077.
(proc_open problems with BSD)
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.84.2.2 php4/ext/standard/exec.c:1.84.2.3
--- php4/ext/standard/exec.c:1.84.2.2 Thu Dec 12 12:44:48 2002
+++ php4/ext/standard/exec.c Thu Dec 19 15:34:33 2002
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.84.2.2 2002/12/12 17:44:48 wez Exp $ */
+/* $Id: exec.c,v 1.84.2.3 2002/12/19 20:34:33 wez Exp $ */
#include <stdio.h>
#include "php.h"
@@ -976,7 +976,7 @@
fp = fdopen(descriptors[i].parentend, mode_string);
#endif
if (fp) {
- stream = php_stream_fopen_from_pipe(fp,
mode_string);
+ stream = php_stream_fopen_from_file(fp,
+mode_string);
if (stream) {
zval *retfp;
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.125.2.20 php4/main/streams.c:1.125.2.21
--- php4/main/streams.c:1.125.2.20 Thu Dec 12 12:44:48 2002
+++ php4/main/streams.c Thu Dec 19 15:34:34 2002
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.125.2.20 2002/12/12 17:44:48 wez Exp $ */
+/* $Id: streams.c,v 1.125.2.21 2002/12/19 20:34:34 wez Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -1298,6 +1298,7 @@
PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode
STREAMS_DC TSRMLS_DC)
{
php_stdio_stream_data *self;
+ php_stream *stream;
self = emalloc_rel_orig(sizeof(*self));
self->file = file;
@@ -1314,7 +1315,13 @@
}
#endif
- return php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode);
+ stream = php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode);
+
+ if (stream && self->is_pipe) {
+ stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
+ }
+
+ return stream;
}
PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode
STREAMS_DC TSRMLS_DC)
@@ -1403,10 +1410,11 @@
ret = WEXITSTATUS(ret);
}
#endif
-
} else {
ret = fclose(data->file);
}
+ } else {
+ return 0;/* everything should be closed already -> success*/
}
if (data->temp_file_name) {
unlink(data->temp_file_name);
@@ -1786,7 +1794,7 @@
/* skip the sanity check; fstat doesn't appear to work on
* UNC paths */
if (!IS_UNC_PATH(filename, strlen(filename)))
-#endif
+#endif
goto err;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php