From: VMware, Inc <> Date: Thu, 18 Nov 2010 22:57:01 +0000 (-0800) Subject: Don't use g_atomic_int_set in old glib versions. X-Git-Tag: 2010.11.17-327185~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=170aec5b0ae2d8811fe30e1109beba2a5a529335;p=thirdparty%2Fopen-vm-tools.git Don't use g_atomic_int_set in old glib versions. Also use the correct version check macro. In old versions, emulate set() with an assignment + explicit fence. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/libvmtools/fileLogger.c b/open-vm-tools/libvmtools/fileLogger.c index 7ca0b840d..fc07653b2 100644 --- a/open-vm-tools/libvmtools/fileLogger.c +++ b/open-vm-tools/libvmtools/fileLogger.c @@ -34,6 +34,7 @@ #endif #include "vm_assert.h" +#include "vm_atomic.h" typedef struct FileLoggerData { LogHandlerData handler; @@ -167,7 +168,12 @@ VMFileLoggerOpen(FileLoggerData *data) if (g_file_test(path, G_FILE_TEST_EXISTS)) { struct stat fstats; if (g_stat(path, &fstats) > -1) { +#if GLIB_CHECK_VERSION(2, 10, 0) g_atomic_int_set(&data->logSize, (gint) fstats.st_size); +#else + data->logSize = (gint) fstats.st_size; + Atomic_MFence(); +#endif } if (!data->append || g_atomic_int_get(&data->logSize) >= data->maxSize) { @@ -213,7 +219,12 @@ VMFileLoggerOpen(FileLoggerData *data) g_free(g_ptr_array_index(logfiles, id)); } g_ptr_array_free(logfiles, TRUE); +#if GLIB_CHECK_VERSION(2, 10, 0) g_atomic_int_set(&data->logSize, 0); +#else + data->logSize = 0; + Atomic_MFence(); +#endif data->append = FALSE; } } diff --git a/open-vm-tools/services/vmtoolsd/cmdLine.c b/open-vm-tools/services/vmtoolsd/cmdLine.c index 09fc4f0c6..fe0969d22 100644 --- a/open-vm-tools/services/vmtoolsd/cmdLine.c +++ b/open-vm-tools/services/vmtoolsd/cmdLine.c @@ -264,7 +264,7 @@ ToolsCore_ParseCommandLine(ToolsServiceState *state, #endif context = g_option_context_new(NULL); -#if GLIB_MAJOR_VERSION >= 2 && GLIB_MINOR_VERSION >= 12 +#if GLIB_CHECK_VERSION(2, 12, 0) g_option_context_set_summary(context, N_("Runs the VMware Tools daemon.")); #endif g_option_context_add_main_entries(context, clOptions, NULL);