Merge branch 'dbus-1.4'
[platform/upstream/dbus.git] / dbus / dbus-internals.c
index 4cafb26..fcea079 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-protocol.h"
 #include "dbus-marshal-basic.h"
@@ -30,6 +32,7 @@
 #include <stdlib.h>
 #ifdef DBUS_USE_OUTPUT_DEBUG_STRING
 #include <windows.h>
+#include <mbstring.h>
 #endif
 
 /**
@@ -298,9 +301,6 @@ static dbus_bool_t verbose = TRUE;
 #include <pthread.h>
 #endif
 
-#ifdef _MSC_VER
-#define inline
-#endif
 #ifdef DBUS_USE_OUTPUT_DEBUG_STRING
 static char module_name[1024];
 #endif
@@ -347,7 +347,6 @@ _dbus_verbose_init (void)
 static char *_dbus_file_path_extract_elements_from_tail(const char *file,int level)
 {
   static int prefix = -1;
-  char *p;
 
   if (prefix == -1) 
     {
@@ -436,11 +435,11 @@ _dbus_verbose_real (const char *format,
   char buf[1024];
   strcpy(buf,module_name);
 #ifdef DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS
-  vsprintf (buf+strlen(buf), "[%s(%d):%s] ",_dbus_file_path_extract_elements_from_tail(file,2),line,function);
+  sprintf (buf+strlen(buf), "[%s(%d):%s] ",_dbus_file_path_extract_elements_from_tail(file,2),line,function);
 #endif
   vsprintf (buf+strlen(buf),format, args);
   va_end (args);
-  OutputDebugString(buf);
+  OutputDebugStringA(buf);
   }
 #else
 #ifdef DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS
@@ -716,27 +715,13 @@ _dbus_create_uuid_file_exclusively (const DBusString *filename,
       goto error;
     }
   
-  /* FIXME this is racy; we need a save_file_exclusively
-   * function. But in practice this should be fine for now.
-   *
-   * - first be sure we can create the file and it
-   *   doesn't exist by creating it empty with O_EXCL
-   * - then create it by creating a temporary file and
-   *   overwriting atomically with rename()
-   */
-  if (!_dbus_create_file_exclusively (filename, error))
-    goto error;
-
   if (!_dbus_string_append_byte (&encoded, '\n'))
     {
       _DBUS_SET_OOM (error);
       goto error;
     }
   
-  if (!_dbus_string_save_to_file (&encoded, filename, error))
-    goto error;
-
-  if (!_dbus_make_file_world_readable (filename, error))
+  if (!_dbus_string_save_to_file (&encoded, filename, TRUE, error))
     goto error;
 
   _dbus_string_free (&encoded);