summaryrefslogtreecommitdiff
path: root/ext/standard/php_fopen_wrapper.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2003-02-13 13:43:37 +0000
committerWez Furlong <wez@php.net>2003-02-13 13:43:37 +0000
commit95e7c2e9edfec601286b072253d0ff991f8dfcb2 (patch)
tree20d58e3a1efb6307a1d9cd9fb060699b74047293 /ext/standard/php_fopen_wrapper.c
parent35878992d869110bc3f6a1e11fa132fe606dbceb (diff)
downloadphp-git-95e7c2e9edfec601286b072253d0ff991f8dfcb2.tar.gz
Use FILE*-less implementation for php://(stdin|stdout|stderr)
Diffstat (limited to 'ext/standard/php_fopen_wrapper.c')
-rw-r--r--ext/standard/php_fopen_wrapper.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index d908cbee83..bf163cc783 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -124,7 +124,7 @@ php_stream_ops php_stream_input_ops = {
php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
{
- FILE * fp = NULL;
+ int fd = -1;
php_stream * stream = NULL;
if (!strncasecmp(path, "php://", 6))
@@ -139,17 +139,17 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch
}
if (!strcasecmp(path, "stdin")) {
- fp = fdopen(dup(STDIN_FILENO), mode);
+ fd = dup(STDIN_FILENO);
} else if (!strcasecmp(path, "stdout")) {
- fp = fdopen(dup(STDOUT_FILENO), mode);
+ fd = dup(STDOUT_FILENO);
} else if (!strcasecmp(path, "stderr")) {
- fp = fdopen(dup(STDERR_FILENO), mode);
+ fd = dup(STDERR_FILENO);
}
- if (fp) {
- stream = php_stream_fopen_from_file(fp, mode);
+ if (fd) {
+ stream = php_stream_fopen_from_fd(fd, mode);
if (stream == NULL)
- fclose(fp);
+ close(fd);
}
return stream;
}