mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 09:51:41 +00:00
Check for getuid and cope when it's not there.
The ps3toolchain doesn't have getuid or getpwent. Nor does it have timeGetTime, so use Sys_DoubleTime instead.
This commit is contained in:
parent
6200d35109
commit
3b047a3cc1
2 changed files with 12 additions and 6 deletions
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue