helly           Sat Oct 30 10:33:28 2004 EDT

  Modified files:              
    /php-src/ext/spl    spl_directory.c 
  Log:
  strip trailing (back)slash from path
  
http://cvs.php.net/diff.php/php-src/ext/spl/spl_directory.c?r1=1.27&r2=1.28&ty=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.27 php-src/ext/spl/spl_directory.c:1.28
--- php-src/ext/spl/spl_directory.c:1.27        Fri Sep  3 14:39:30 2004
+++ php-src/ext/spl/spl_directory.c     Sat Oct 30 10:33:25 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_directory.c,v 1.27 2004/09/03 18:39:30 helly Exp $ */
+/* $Id: spl_directory.c,v 1.28 2004/10/30 14:33:25 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -120,9 +120,14 @@
 /* open a directory resource */
 static void spl_ce_dir_open(spl_ce_dir_object* intern, char *path TSRMLS_DC)
 {
+       int path_len = strlen(path);
        intern->dirp = php_stream_opendir(path, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
 
-       intern->path = estrdup(path);
+       if (path_len && (path[path_len-1] == '/' || path[path_len-1] == '\\')) {
+               intern->path = estrndup(path, --path_len);
+       } else {
+               intern->path = estrndup(path, path_len);
+       }
        intern->index = 0;
 
        if (intern->dirp == NULL) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to