MinGW fixes
authorNils Durner <durner@gnunet.org>
Sun, 15 Nov 2009 10:03:47 +0000 (10:03 +0000)
committerNils Durner <durner@gnunet.org>
Sun, 15 Nov 2009 10:03:47 +0000 (10:03 +0000)
src/util/common_logging.c
src/util/disk.c

index 5af499341b1f43fe12e694f9b8cb4a3c302310a9..b0c97df7db2738d752389bc686fffe97c9a67258 100644 (file)
@@ -167,7 +167,7 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)
   min_level = get_type (loglevel);
   if (logfile == NULL)
     return GNUNET_OK;
-  altlog = fopen (logfile, "a");
+  altlog = FOPEN (logfile, "a");
   if (altlog == NULL)
     {
       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "fopen", logfile);
index ce0b2676f1433612b019e319b4282861d5689189..79b1b64a81722a1aeea0d7c1086cd2b1c29e8083 100644 (file)
@@ -284,10 +284,15 @@ GNUNET_DISK_mktemp (const char *t)
   tmpdir = getenv ("TMPDIR");
   tmpdir = tmpdir ? tmpdir : "/tmp";
 
-  GNUNET_asprintf (&tmpl, "%s%s%s%s", tmpdir, DIR_SEPARATOR_STR, t, "XXXXXX");
+  GNUNET_asprintf (&tmpl, "%s/%s%s", tmpdir, t, "XXXXXX");
 #ifdef MINGW
   fn = (char *) GNUNET_malloc (MAX_PATH + 1);
-  plibc_conv_to_win_path (tmpl, fn);
+  if (ERROR_SUCCESS != plibc_conv_to_win_path (tmpl, fn))
+    {
+      GNUNET_free (fn);
+      GNUNET_free (tmpl);
+      return NULL;
+    }
   GNUNET_free (tmpl);
 #else
   fn = tmpl;
@@ -1185,6 +1190,8 @@ GNUNET_DISK_file_open (const char *fn,
 #endif
 
   expfn = GNUNET_STRINGS_filename_expand (fn);
+  if (NULL == expfn)
+    return NULL;
 
 #ifndef MINGW
   mode = 0;