diff --git a/config.d/library_functions.m4 b/config.d/library_functions.m4 index 32edf76c3..26d1ee5c1 100644 --- a/config.d/library_functions.m4 +++ b/config.d/library_functions.m4 @@ -10,8 +10,8 @@ AC_FUNC_VPRINTF AC_FUNC_VA_COPY AC_FUNC__VA_COPY AC_CHECK_FUNCS( - access _access gethostname gethostbyname connect gettimeofday getwd \ - mkdir _mkdir ftime _ftime fcntl stat putenv select socket strerror \ + access _access gethostname gethostbyname connect gettimeofday getuid \ + getwd mkdir _mkdir ftime _ftime fcntl stat putenv select socket strerror \ strcasestr strnlen strstr snprintf _snprintf vsnprintf _vsnprintf \ strsep dlopen getaddrinfo getnameinfo mprotect getpagesize ) diff --git a/libs/util/sys.c b/libs/util/sys.c index 1453d7a70..ac6c062b1 100644 --- a/libs/util/sys.c +++ b/libs/util/sys.c @@ -488,10 +488,10 @@ VISIBLE int Sys_TimeID (void) //FIXME I need a new name, one that doesn't make me feel 3 feet thick { int val; -#ifdef _WIN32 - val = ((int) (timeGetTime () * 1000) * time (NULL)) & 0xffff; -#else +#ifdef HAVE_GETUID val = ((int) (getpid () + getuid () * 1000) * time (NULL)) & 0xffff; +#else + val = ((int) (Sys_DoubleTime () * 1000) * time (NULL)) & 0xffff; #endif return val; } @@ -813,10 +813,12 @@ Sys_CreatePath (const char *path) char * Sys_ExpandSquiggle (const char *path) { - char *home; + const char *home; #ifndef _WIN32 +# ifdef HAVE_GETUID struct passwd *pwd_ent; +# endif #endif if (strncmp (path, "~/", 2) != 0) { @@ -830,10 +832,14 @@ Sys_ExpandSquiggle (const char *path) if (!home || !home[0]) home = getenv ("WINDIR"); #else +# ifdef HAVE_GETUID if ((pwd_ent = getpwuid (getuid ()))) { home = pwd_ent->pw_dir; } else home = getenv ("HOME"); +# else + home = ""; //FIXME configurable? +# endif #endif if (home)