From a6a2797a6963e6bc33d71aff878d5d38fd1e2e54 Mon Sep 17 00:00:00 2001 From: Sebastien Vincent Date: Mon, 24 May 2010 08:08:25 -0700 Subject: [PATCH] fix build on MinGW (32-bit and 64-bit) --- utils/test-runner.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/test-runner.cc b/utils/test-runner.cc index 75fff021b..094ef6d76 100644 --- a/utils/test-runner.cc +++ b/utils/test-runner.cc @@ -66,8 +66,8 @@ TempDir (void) // But we also randomize the name in case there are multiple users doing // this at the same time // - srandom (time (0)); - long int n = random (); + srand (time (0)); + long int n = rand (); // // The final path to the directory is going to look something like @@ -83,7 +83,11 @@ TempDir (void) char dirname[1024]; snprintf (dirname, sizeof(dirname), "%s/ns-3.%d.%d.%d.%ld", path, tm_now->tm_hour, tm_now->tm_min, tm_now->tm_sec, n); +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__CYGWIN__) + if(mkdir(dirname) == 0) +#else if (mkdir (dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == 0) +#endif { return dirname; }