1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-12-01 13:24:25 +01:00

Fix linux build.

This commit is contained in:
Nicholas Hastings 2013-10-24 13:30:44 -04:00
parent 835d9cc964
commit 51f88b5081

View File

@ -235,31 +235,30 @@ mm_GetGameName(char *buffer, size_t size)
#elif defined __linux__ #elif defined __linux__
FILE *pFile = fopen("/proc/self/cmdline", "rb"); FILE *pFile = fopen("/proc/self/cmdline", "rb");
if (!pFile) if (pFile)
return false;
char *arg = NULL;
size_t argsize = 0;
bool bNextIsGame = false;
while (getdelim(&arg, &argsize, 0, pFile) != -1)
{ {
if (bNextIsGame) char *arg = NULL;
size_t argsize = 0;
bool bNextIsGame = false;
while (getdelim(&arg, &argsize, 0, pFile) != -1)
{ {
strncpy(buffer, arg, size); if (bNextIsGame)
buffer[size-1] = '\0'; {
break; strncpy(buffer, arg, size);
buffer[size-1] = '\0';
break;
}
if (strcmp(arg, "-game") == 0)
{
bNextIsGame = true;
}
} }
if (strcmp(arg, "-game") == 0) free(arg);
{ fclose(pFile);
bNextIsGame = true;
}
} }
free(arg);
fclose(pFile);
#else #else
#error unsupported platform #error unsupported platform
#endif #endif