cvs: TSRM / tsrm_virtual_cwd.h

From: Date: Thu, 07 Aug 2003 15:32:19 +0000
Subject: cvs: TSRM / tsrm_virtual_cwd.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1618@lists.php.net to get a copy of this message
iliaa Thu Aug 7 11:32:19 2003 EDT Modified files: /TSRM tsrm_virtual_cwd.h Log: Fixed bug #21958 (workaround for unusual realpath() on AIX & Tru64). Index: TSRM/tsrm_virtual_cwd.h diff -u TSRM/tsrm_virtual_cwd.h:1.38 TSRM/tsrm_virtual_cwd.h:1.39 --- TSRM/tsrm_virtual_cwd.h:1.38 Wed Jun 25 01:05:06 2003 +++ TSRM/tsrm_virtual_cwd.h Thu Aug 7 11:32:18 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.h,v 1.38 2003/06/25 05:05:06 sebastian Exp $ */ +/* $Id: tsrm_virtual_cwd.h,v 1.39 2003/08/07 15:32:18 iliaa Exp $ */ #ifndef VIRTUAL_CWD_H #define VIRTUAL_CWD_H @@ -41,6 +41,10 @@ #include <unistd.h> #endif +#if defined(__osf__) || defined(_AIX) +#include <errno.h> +#endif + #ifdef TSRM_WIN32 #include "readdir.h" #include <sys/utime.h> @@ -167,6 +171,25 @@ #endif #endif +/* On AIX & Tru64 when a file does not exist realpath() returns + * NULL, and sets errno to ENOENT. Unlike in other libc implementations + * the destination is not filled and remains undefined. Therefor, we + * must populate it manually using strcpy as done on systems with no + * realpath() function. + */ +#if defined(__osf__) || defined(_AIX) +static char *php_realpath_hack(char *src, char *dest) +{ + char *ret; + + if ((ret = realpath(src, dest)) == NULL && errno == ENOENT) { + return strcpy(dest, src); + } else { + return ret; + } +} +#endif + #if HAVE_UTIME CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC); #endif @@ -248,7 +271,11 @@ #endif #ifdef HAVE_REALPATH +#if defined(__osf__) || defined(_AIX) +#define VCWD_REALPATH(path, real_path) php_realpath_hack(path, real_path) +#else #define VCWD_REALPATH(path, real_path) realpath(path, real_path) +#endif #else #define VCWD_REALPATH(path, real_path) strcpy(real_path, path) #endif

« previous php.zend-engine.cvs (#1618) next »