[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] cvs: php-src(PHP_5_2) /main php_scandir.c
From:       "Ilia Alshanetsky" <iliaa () php ! net>
Date:       2006-11-30 16:10:38
Message-ID: cvsiliaa1164903038 () cvsserver
[Download RAW message or body]

iliaa		Thu Nov 30 16:10:38 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/main	php_scandir.c 
  Log:
  Thread-safety issues
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/php_scandir.c?r1=1.12.2.1&r2=1.12.2.1.2.1&diff_format=u
Index: php-src/main/php_scandir.c
diff -u php-src/main/php_scandir.c:1.12.2.1 php-src/main/php_scandir.c:1.12.2.1.2.1
--- php-src/main/php_scandir.c:1.12.2.1	Sun Jan  1 12:50:17 2006
+++ php-src/main/php_scandir.c	Thu Nov 30 16:10:38 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_scandir.c,v 1.12.2.1 2006/01/01 12:50:17 sniper Exp $ */
+/* $Id: php_scandir.c,v 1.12.2.1.2.1 2006/11/30 16:10:38 iliaa Exp $ */
 
 #include "php_scandir.h"
 
@@ -62,6 +62,8 @@
 	struct dirent *dp = NULL;
 	int vector_size = 0;
 	int nfiles = 0;
+	char entry[sizeof(struct dirent)+MAXPATHLEN];
+	struct dirent *result = (struct dirent *)&entry;
 
 	if (namelist == NULL) {
 		return -1;
@@ -71,7 +73,7 @@
 		return -1;
 	}
 
-	while ((dp = readdir(dirp)) != NULL) {
+	while ((dp = php_readdir_r(dirp, (struct dirent *)entry, &result)) == 0 && result) {
 		int dsize = 0;
 		struct dirent *newdp = NULL;
 

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic