]> granicus.if.org Git - php/commitdiff
- Hopefully got most of them. We also need a chdir_file function like
authorAndi Gutmans <andi@php.net>
Thu, 30 Mar 2000 22:56:34 +0000 (22:56 +0000)
committerAndi Gutmans <andi@php.net>
Thu, 30 Mar 2000 22:56:34 +0000 (22:56 +0000)
  for Apache.

13 files changed:
ext/db/db.c
ext/filepro/filepro.c
ext/ftp/php_ftp.c
ext/gd/gd.c
ext/posix/posix.c
ext/rpc/com/COM.c
ext/standard/dir.c
ext/standard/filestat.c
ext/standard/image.c
ext/standard/iptc.c
main/php.h
sapi/isapi/php4isapi.c
sapi/servlet/servlet.c

index ab1412d086703e143f3ebefca36b6da8a0e04ca9..8d7fc7cb5cd0197da61dba82d8f1ab4f6f8b1359 100644 (file)
@@ -122,7 +122,7 @@ static int php_dbm_key_exists(DBM *dbf, datum key_datum) {
 #define DBM_CREATE_MODE "a+b"
 #define DBM_NEW_MODE "w+b"
 #define DBM_DEFAULT_MODE "r"
-#define DBM_OPEN(filename, mode) fopen(filename, mode)
+#define DBM_OPEN(filename, mode) PHP_FOPEN(filename, mode)
 #define DBM_CLOSE(dbf) fclose(dbf)
 #define DBM_STORE(dbf, key, value, mode) flatfile_store(dbf, key, value, mode)
 #define DBM_FETCH(dbf, key) flatfile_fetch(dbf, key)
index e8d2dfc7cfc12cd82b2a70d489ffe23e3c85535d..3de10645e4eea9e9cd6abf19c5eb4685d16e5667 100644 (file)
@@ -210,7 +210,7 @@ PHP_FUNCTION(filepro)
                RETURN_FALSE;
        }
 
-       if (!(fp = fopen(workbuf, "r"))) {
+       if (!(fp = PHP_FOPEN(workbuf, "r"))) {
                php_error(E_WARNING, "filePro: cannot open map: [%d] %s",
                                        errno, strerror(errno));
                RETURN_FALSE;
@@ -306,7 +306,7 @@ PHP_FUNCTION(filepro_rowcount)
                RETURN_FALSE;
        }
 
-       if (!(fp = fopen(workbuf, "r"))) {
+       if (!(fp = PHP_FOPEN(workbuf, "r"))) {
                php_error(E_WARNING, "filePro: cannot open key: [%d] %s",
                                        errno, strerror(errno));
                RETURN_FALSE;
@@ -516,7 +516,7 @@ PHP_FUNCTION(filepro_retrieve)
                RETURN_FALSE;
        }
 
-       if (!(fp = fopen(workbuf, "r"))) {
+       if (!(fp = PHP_FOPEN(workbuf, "r"))) {
                php_error(E_WARNING, "filePro: cannot open key: [%d] %s",
                                        errno, strerror(errno));
            fclose(fp);
index 70859376e3641bf6c0e27e099a8638a4f2407fa2..d1e0d2e749760822b4a12e6c4f1276b79e35b1f8 100644 (file)
@@ -550,7 +550,7 @@ PHP_FUNCTION(ftp_get)
                RETURN_FALSE;
        }
 
-       if ((outfp = fopen(arg2->value.str.val, "w")) == NULL) {
+       if ((outfp = PHP_FOPEN(arg2->value.str.val, "w")) == NULL) {
                fclose(tmpfp);
                php_error(E_WARNING, "error opening %s", arg2->value.str.val);
                RETURN_FALSE;
@@ -634,7 +634,7 @@ PHP_FUNCTION(ftp_put)
        convert_to_string(arg3);
        XTYPE(xtype, arg4);
 
-       if ((infp = fopen(arg3->value.str.val, "r")) == NULL) {
+       if ((infp = PHP_FOPEN(arg3->value.str.val, "r")) == NULL) {
                php_error(E_WARNING, "error opening %s", arg3->value.str.val);
                RETURN_FALSE;
        }
index 57f1c57b631da61d55f5941cb749757f6972cc41..50ffb70b5e67a45dff570af0d6e2872e8808e714 100644 (file)
@@ -331,8 +331,8 @@ PHP_FUNCTION(imageloadfont) {
 
        convert_to_string_ex(file);
 
-#if WIN32|WINNT
-       fp = fopen((*file)->value.str.val, "rb");
+#ifdef PHP_WIN32
+       fp = PHP_FOPEN((*file)->value.str.val, "rb");
 #else
        fp = php_fopen_wrapper((*file)->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
@@ -434,8 +434,8 @@ PHP_FUNCTION(imagecreatefrompng)
        }
        convert_to_string_ex(file);
        fn = (*file)->value.str.val;
-#if WIN32|WINNT
-       fp = fopen((*file)->value.str.val, "rb");
+#ifdef PHP_WIN32
+       fp = PHP_FOPEN((*file)->value.str.val, "rb");
 #else
        fp = php_fopen_wrapper((*file)->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
@@ -481,7 +481,7 @@ PHP_FUNCTION(imagepng)
        }
 
        if (argc == 2) {
-               fp = fopen(fn, "wb");
+               fp = PHP_FOPEN(fn, "wb");
                if (!fp) {
                        php_error(E_WARNING, "ImagePng: unable to open %s for writing", fn);
                        RETURN_FALSE;
@@ -542,8 +542,8 @@ PHP_FUNCTION(imagecreatefromgif )
 
        fn = (*file)->value.str.val;
 
-#if WIN32|WINNT
-       fp = fopen((*file)->value.str.val, "rb");
+#ifdef PHP_WIN32
+       fp = PHP_FOPEN((*file)->value.str.val, "rb");
 #else
        fp = php_fopen_wrapper((*file)->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
@@ -592,7 +592,7 @@ PHP_FUNCTION(imagegif)
        }
 
        if (argc == 2) {
-               fp = fopen(fn, "wb");
+               fp = PHP_FOPEN(fn, "wb");
                if (!fp) {
                        php_error(E_WARNING, "ImageGif: unable to open %s for writing", fn);
                        RETURN_FALSE;
@@ -657,8 +657,8 @@ PHP_FUNCTION(imagecreatefromjpeg)
        }
        convert_to_string_ex(file);
        fn = (*file)->value.str.val;
-#if WIN32|WINNT
-       fp = fopen((*file)->value.str.val, "rb");
+#ifdef PHP_WIN32
+       fp = PHP_FOPEN((*file)->value.str.val, "rb");
 #else
        fp = php_fopen_wrapper((*file)->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
@@ -709,7 +709,7 @@ PHP_FUNCTION(imagejpeg)
        }
 
        if (argc > 1 && fn && strlen(fn)) {
-               fp = fopen(fn, "wb");
+               fp = PHP_FOPEN(fn, "wb");
                if (!fp) {
                        php_error(E_WARNING, "ImageJpeg: unable to open %s for writing", fn);
                        RETURN_FALSE;
index 5d8e2c38c1682ad92056a35d8cf2d635509e1885..38a9e12e6342774996506aa7b53bd5b50b95d1d2 100644 (file)
@@ -568,7 +568,7 @@ PHP_FUNCTION(posix_getcwd)
        char  buffer[MAXPATHLEN];
        char *p;
 
-       p = getcwd(buffer, MAXPATHLEN);
+       p = PHP_GETCWD(buffer, MAXPATHLEN);
        if (!p) {
                php_error(E_WARNING, "posix_getcwd() failed with '%s'",
                        strerror(errno));
index 8d64ffcbc3fa86528a98bf4e41851f3bb830de56..8be37e64bcb81f01ce48ca9db7f1d57394a58276 100644 (file)
@@ -161,7 +161,7 @@ static PHP_INI_MH(OnTypelibFileChange)
 #endif
 
 
-       if (!new_value || (typelib_file=fopen(new_value, "r"))==NULL) {
+       if (!new_value || (typelib_file=PHP_FOPEN(new_value, "r"))==NULL) {
                return FAILURE;
        }
 
index e71697e859a9a53ed622360cce2b7e6863cd511d..03535b1148d1c736577ec12fb02b6226eadd32c9 100644 (file)
@@ -210,7 +210,7 @@ PHP_FUNCTION(chdir)
        }
        convert_to_string_ex(arg);
 
-       ret = chdir((*arg)->value.str.val);
+       ret = PHP_CHDIR((*arg)->value.str.val);
        
        if (ret < 0) {
                php_error(E_WARNING, "ChDir: %s (errno %d)", strerror(errno), errno);
@@ -234,9 +234,9 @@ PHP_FUNCTION(getcwd)
        }
 
 #if HAVE_GETCWD
-       ret = getcwd(path,MAXPATHLEN-1);
+       ret = PHP_GETCWD(path,MAXPATHLEN-1);
 #elif HAVE_GETWD
-       ret = getwd(path);
+       ret = PHP_GETWD(path);
 /*
  * #warning is not ANSI C
  * #else
index 1542f27501e0bd2936327ec6a7f9b8491ca7178c..61959f32d2fa80539c403e6be7aef776d917042e 100644 (file)
@@ -387,7 +387,7 @@ PHP_FUNCTION(touch)
        /* create the file if it doesn't exist already */
        ret = stat((*filename)->value.str.val, &sb);
        if (ret == -1) {
-               file = fopen((*filename)->value.str.val, "w");
+               file = PHP_FOPEN((*filename)->value.str.val, "w");
                if (file == NULL) {
                        php_error(E_WARNING, "unable to create file %s because %s", (*filename)->value.str.val, strerror(errno));
                        if (newtime) efree(newtime);
index 021a142acc9206f762114fe71e62cb0453226b9b..30930c253db0c16cbdddb49c107a909fe7dd67c5 100644 (file)
@@ -338,7 +338,7 @@ PHP_FUNCTION(getimagesize)
        /* Check open_basedir */
        if (php_check_open_basedir((*arg1)->value.str.val)) return;
        
-       if ((fp = fopen((*arg1)->value.str.val,"rb")) == 0) {
+       if ((fp = PHP_FOPEN((*arg1)->value.str.val,"rb")) == 0) {
                php_error(E_WARNING, "Unable to open %s", (*arg1)->value.str.val);
                return;
        }
index a1365e25f231daaa43bf4873efc200070f0ac211..619f95f5dc11af48ec3dd94517dfc964964187eb 100644 (file)
@@ -198,7 +198,7 @@ PHP_FUNCTION(iptcembed)
     if (php_check_open_basedir((*jpeg_file)->value.str.val)) 
                RETURN_FALSE;
 
-    if ((fp = fopen((*jpeg_file)->value.str.val,"rb")) == 0) {
+    if ((fp = PHP_FOPEN((*jpeg_file)->value.str.val,"rb")) == 0) {
         php_error(E_WARNING, "Unable to open %s", (*jpeg_file)->value.str.val);
         RETURN_FALSE;
     }
index 484d8af81f65e7a2e17b016d0bd898e64fe45078..0d84b4d7e82930fb58ce04a945410114d8ab9258 100644 (file)
@@ -289,10 +289,12 @@ PHPAPI int cfg_get_string(char *varname, char **result);
 #define PHP_GETCWD(buff, size) virtual_getcwd(buff,size)
 #define PHP_FOPEN(path, mode) virtual_fopen(path, mode)
 #define PHP_CHDIR(path) virtual_chdir(path)
+#define PHP_GETWD(buf)
 #else
 #define PHP_GETCWD(buff, size) getcwd(buff,size)
 #define PHP_FOPEN(path, mode)  fopen(path, mode)
 #define PHP_CHDIR(path) chdir(path)
+#define PHP_GETWD(buf) getwd(buf)
 #endif
 
 #include "zend_constants.h"
index 1266ba31527cc85044ae143bb240c80b35ca70ab..2fa11239d62c17701273610483e78ff79f41e177 100644 (file)
@@ -456,7 +456,7 @@ static void init_request_info(sapi_globals_struct *sapi_globals, LPEXTENSION_CON
 
                if (path_end) {
                        *path_end = 0;
-                       chdir(SG(request_info).path_translated);
+                       PHP_CHDIR(SG(request_info).path_translated);
                        *path_end = '\\';
                }
        }
index a7e35ef31d1719d34c6ac8aac6117b33206f83a2..3546c61914e192df9f1df6210d3b4ddd4f7edfd2 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <stdio.h>
 #include "php.h"
-#if WIN32|WINNT
+#ifdef PHP_WIN32
 #include "win32/time.h"
 #include "win32/signal.h"
 #include <process.h>
@@ -52,7 +52,7 @@
 #include "fopen-wrappers.h"
 #include "ext/standard/php_standard.h"
 #include "ext/standard/php_dir.h"
-#if WIN32|WINNT
+#ifdef PHP_WIN32
 #include <io.h>
 #include <fcntl.h>
 #include "win32/syslog.h"