cvs: php4 /ext/standard php_fopen_wrapper.c

From: Date: Thu, 13 Feb 2003 13:43:38 +0000
Subject: cvs: php4 /ext/standard php_fopen_wrapper.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-18768@lists.php.net to get a copy of this message
wez Thu Feb 13 08:43:38 2003 EDT Modified files: /php4/ext/standard php_fopen_wrapper.c Log: Use FILE*-less implementation for php://(stdin|stdout|stderr) Index: php4/ext/standard/php_fopen_wrapper.c diff -u php4/ext/standard/php_fopen_wrapper.c:1.31 php4/ext/standard/php_fopen_wrapper.c:1.32 --- php4/ext/standard/php_fopen_wrapper.c:1.31 Tue Dec 31 11:07:51 2002 +++ php4/ext/standard/php_fopen_wrapper.c Thu Feb 13 08:43:37 2003 @@ -17,7 +17,7 @@ | Hartmut Holzgraefe <hholzgra@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: php_fopen_wrapper.c,v 1.31 2002/12/31 16:07:51 sebastian Exp $ */ +/* $Id: php_fopen_wrapper.c,v 1.32 2003/02/13 13:43:37 wez Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -124,7 +124,7 @@ 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 @@ } 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; }

« previous php.cvs (#18768) next »