cvs: php4 /main php_realpath.c

From: Date: Thu, 27 Jul 2000 13:48:50 +0000
Subject: cvs: php4 /main php_realpath.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-952@lists.php.net to get a copy of this message
stas Thu Jul 27 06:48:50 2000 EDT Modified files: /php4/main php_realpath.c Log: Fix realpath not to die on non-existing files (bug #5790) Thanks to china@thewrittenword.com Index: php4/main/php_realpath.c diff -u php4/main/php_realpath.c:1.9 php4/main/php_realpath.c:1.10 --- php4/main/php_realpath.c:1.9 Thu May 18 08:34:21 2000 +++ php4/main/php_realpath.c Thu Jul 27 06:48:50 2000 @@ -251,15 +251,18 @@ } /* Check if the resolved path is a directory */ - if (V_STAT(path_construction, &filestat) != 0) return NULL; - if (S_ISDIR(filestat.st_mode)) { - /* It's a directory, append a / if needed */ - if (*(writepos-1) != '/') { - /* Check for overflow */ - if ((strlen(workpos) + 2) >= MAXPATHLEN) return NULL; - - *writepos++ = '/'; - *writepos = 0; + if (V_STAT(path_construction, &filestat) != 0) { + if (errno != ENOENT) return NULL; + } else { + if (S_ISDIR(filestat.st_mode)) { + /* It's a directory, append a / if needed */ + if (*(writepos-1) != '/') { + /* C heck for overflow */ + if ((strlen(workpos) + 2) >= MAXPATHLEN) return NULL; + + *writepos++ = '/'; + *writepos = 0; + } } }

« previous php.cvs (#952) next »