javacommons/fileutils/src/fileutilities.cpp
changeset 64 0ea12c182930
parent 49 35baca0e7a2e
child 66 2455ef1f5bbc
--- a/javacommons/fileutils/src/fileutilities.cpp	Thu Aug 05 16:07:57 2010 +0300
+++ b/javacommons/fileutils/src/fileutilities.cpp	Mon Aug 23 14:24:31 2010 +0300
@@ -323,7 +323,8 @@
         char *dirName = JavaCommonUtils::wstringToUtf8(path);
         if (ableToOpen)
         {
-            if (!opendir(dirName))
+            DIR* wDirHandle = opendir(dirName);
+            if (!wDirHandle)
             {
                 ableToOpen = false;
                 if (mkdir(dirName,0666)<0)
@@ -334,6 +335,7 @@
                     return -1;
                 }
             }
+            closedir(wDirHandle); 
         }
         else
         {