From 63141c38b9f160cd2b71c8e794847a12ea75d09c Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 14 Mar 2009 12:37:29 -0700 Subject: [PATCH] rid mac os 10.5 warning: utmp is deprecated --- src/sigar.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/sigar.c b/src/sigar.c index b371bace..c9904b9d 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -981,6 +981,16 @@ SIGAR_DECLARE(int) sigar_who_list_destroy(sigar_t *sigar, return SIGAR_OK; } +#ifdef DARWIN +#include +#endif +#ifdef MAC_OS_X_VERSION_10_5 +# if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 +# define SIGAR_NO_UTMP +# endif +/* else 10.4 and earlier or compiled with -mmacosx-version-min=10.3 */ +#endif + #if defined(__sun) # include # define SIGAR_UTMP_FILE _UTMPX_FILE @@ -1014,7 +1024,7 @@ static char *getpass(const char *prompt) return (char *)&password; } -#else +#elif !defined(SIGAR_NO_UTMP) # include # ifdef UTMP_FILE # define SIGAR_UTMP_FILE UTMP_FILE @@ -1099,6 +1109,9 @@ static int sigar_who_utmpx(sigar_t *sigar, } #endif +#if defined(SIGAR_NO_UTMP) && defined(SIGAR_HAS_UTMPX) +#define sigar_who_utmp sigar_who_utmpx +#else static int sigar_who_utmp(sigar_t *sigar, sigar_who_list_t *wholist) { @@ -1144,7 +1157,7 @@ static int sigar_who_utmp(sigar_t *sigar, return SIGAR_OK; } - +#endif /* SIGAR_NO_UTMP */ #endif /* NETWARE */ #if defined(WIN32)