projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2004-08-21 10:56:59 by panne]
[ghc-base.git]
/
cbits
/
dirUtils.c
diff --git
a/cbits/dirUtils.c
b/cbits/dirUtils.c
index
b3fb6c0
..
08ea54e
100644
(file)
--- a/
cbits/dirUtils.c
+++ b/
cbits/dirUtils.c
@@
-4,7
+4,7
@@
* Directory Runtime Support
*/
* Directory Runtime Support
*/
-#include "config.h"
+#include "ghcconfig.h"
// The following is required on Solaris to force the POSIX versions of
// the various _r functions instead of the Solaris versions.
// The following is required on Solaris to force the POSIX versions of
// the various _r functions instead of the Solaris versions.
@@
-14,7
+14,7
@@
#include "HsBase.h"
#include "HsBase.h"
-#if defined(mingw32_TARGET_OS)
+#if defined(mingw32_TARGET_OS) || defined(__MINGW32__) || defined(_MSC_VER)
#include <windows.h>
static
#include <windows.h>
static
@@
-63,7
+63,7
@@
__hscore_readdir( HsAddr dirPtr, HsAddr pDirEnt )
#if HAVE_READDIR_R
struct dirent* p;
int res;
#if HAVE_READDIR_R
struct dirent* p;
int res;
- static unsigned int nm_max = -1;
+ static unsigned int nm_max = (unsigned int)-1;
if (pDirE == NULL) {
return -1;
if (pDirE == NULL) {
return -1;
@@
-81,7
+81,11
@@
__hscore_readdir( HsAddr dirPtr, HsAddr pDirEnt )
if (p == NULL) return -1;
res = readdir_r((DIR*)dirPtr, p, pDirE);
if (res != 0) {
if (p == NULL) return -1;
res = readdir_r((DIR*)dirPtr, p, pDirE);
if (res != 0) {
- *pDirE = NULL;
+ *pDirE = NULL;
+ free(p);
+ }
+ else if (*pDirE == NULL) {
+ // end of stream
free(p);
}
return res;
free(p);
}
return res;
@@
-113,7
+117,7
@@
HsInt
__hscore_renameFile( HsAddr src,
HsAddr dest)
{
__hscore_renameFile( HsAddr src,
HsAddr dest)
{
-#if (defined(_MSC_VER) || defined(_WIN32))
+#if defined(mingw32_TARGET_OS) || defined(__MINGW32__) || defined(_MSC_VER)
static int forNT = -1;
/* ToDo: propagate error codes back */
static int forNT = -1;
/* ToDo: propagate error codes back */