From 65e808bb55681483a83e15314edd8d6931b41b6a Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Thu, 16 Jan 2014 15:40:23 -0500 Subject: [PATCH] [runtime] Fix a few warnings in io-layer and utils. --- mono/io-layer/io.c | 4 +--- mono/io-layer/processes.c | 6 +++--- mono/utils/mono-proclib.c | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c index 37166faa53b..b67a9ca9b70 100755 --- a/mono/io-layer/io.c +++ b/mono/io-layer/io.c @@ -2082,7 +2082,7 @@ ReplaceFile (const gunichar2 *replacedFileName, const gunichar2 *replacementFile const gunichar2 *backupFileName, guint32 replaceFlags, gpointer exclude, gpointer reserved) { - int result, errno_copy, backup_fd = -1,replaced_fd = -1; + int result, backup_fd = -1,replaced_fd = -1; gchar *utf8_replacedFileName, *utf8_replacementFileName = NULL, *utf8_backupFileName = NULL; struct stat stBackup; gboolean ret = FALSE; @@ -2100,13 +2100,11 @@ ReplaceFile (const gunichar2 *replacedFileName, const gunichar2 *replacementFile // Open the backup file for read so we can restore the file if an error occurs. backup_fd = _wapi_open (utf8_backupFileName, O_RDONLY, 0); result = _wapi_rename (utf8_replacedFileName, utf8_backupFileName); - errno_copy = errno; if (result == -1) goto replace_cleanup; } result = _wapi_rename (utf8_replacementFileName, utf8_replacedFileName); - errno_copy = errno; if (result == -1) { _wapi_set_last_path_error_from_errno (NULL, utf8_replacementFileName); _wapi_rename (utf8_backupFileName, utf8_replacedFileName); diff --git a/mono/io-layer/processes.c b/mono/io-layer/processes.c index 6cf55aca068..98012283ad3 100644 --- a/mono/io-layer/processes.c +++ b/mono/io-layer/processes.c @@ -1384,8 +1384,10 @@ gboolean EnumProcesses (guint32 *pids, guint32 len, guint32 *needed) if (err == 0) done = TRUE; - else + else { free (result); + result = NULL; + } } } while (err == 0 && !done); @@ -1708,9 +1710,7 @@ static GSList *load_modules (void) const struct section *sec; #endif const char *name; - intptr_t slide; - slide = _dyld_get_image_vmaddr_slide (i); name = _dyld_get_image_name (i); #if SIZEOF_VOID_P == 8 hdr = (const struct mach_header_64*)_dyld_get_image_header (i); diff --git a/mono/utils/mono-proclib.c b/mono/utils/mono-proclib.c index 5bd290f75ef..dab3a5579e2 100644 --- a/mono/utils/mono-proclib.c +++ b/mono/utils/mono-proclib.c @@ -561,7 +561,7 @@ get_cpu_times (int cpu_id, gint64 *user, gint64 *systemt, gint64 *irq, gint64 *s char buf [256]; char *s; int hz = get_user_hz (); - guint64 user_ticks = 0, nice_ticks = 0, system_ticks = 0, idle_ticks = 0, iowait_ticks, irq_ticks = 0, sirq_ticks = 0; + guint64 user_ticks = 0, nice_ticks = 0, system_ticks = 0, idle_ticks = 0, irq_ticks = 0, sirq_ticks = 0; FILE *f = fopen ("/proc/stat", "r"); if (!f) return; @@ -583,7 +583,7 @@ get_cpu_times (int cpu_id, gint64 *user, gint64 *systemt, gint64 *irq, gint64 *s nice_ticks = strtoull (data, &data, 10); system_ticks = strtoull (data, &data, 10); idle_ticks = strtoull (data, &data, 10); - iowait_ticks = strtoull (data, &data, 10); + strtoull (data, &data, 10); /* iowait_ticks */ irq_ticks = strtoull (data, &data, 10); sirq_ticks = strtoull (data, &data, 10); break; -- 2.25.1