On Sun, Mar 27, 2011 at 4:05 AM, Russell Bryant
<russell(a)russellbryant.net> wrote:
Constify a variable so that the compiler is happy with the usage of
matahari_uuid().
wont it now complain that the const is being cast away in the call to free() ?
maybe a temp variable is cleaner
Signed-off-by: Russell Bryant <russell(a)russellbryant.net>
---
CMakeLists.txt | 2 +-
src/lib/utilities.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19db062..8431e6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.6)
project (MATAHARI)
-set(CMAKE_VERBOSE_MAKEFILE ON)
+set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "4")
diff --git a/src/lib/utilities.c b/src/lib/utilities.c
index b9d2e0d..cb822fe 100644
--- a/src/lib/utilities.c
+++ b/src/lib/utilities.c
@@ -332,7 +332,7 @@ mh_log_fn(int priority, const char * fmt, ...)
const char *matahari_hostname(void)
{
- static char *hostname = NULL;
+ static const char *hostname = NULL;
if(hostname == NULL) {
sigar_t *sigar;
@@ -343,11 +343,12 @@ const char *matahari_hostname(void)
}
if(hostname != NULL && strcmp(hostname, "localhost") == 0) {
- free(hostname);
+ free((char *) hostname);
hostname = matahari_uuid();
}
mh_trace("Got hostname: %s", hostname);
+
return hostname;
}
--
1.7.4
_______________________________________________
Matahari mailing list
Matahari(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/matahari