1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-11-29 11:24:19 +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__
FILE *pFile = fopen("/proc/self/cmdline", "rb");
if (!pFile)
return false;
char *arg = NULL;
size_t argsize = 0;
bool bNextIsGame = false;
while (getdelim(&arg, &argsize, 0, pFile) != -1)
if (pFile)
{
if (bNextIsGame)
char *arg = NULL;
size_t argsize = 0;
bool bNextIsGame = false;
while (getdelim(&arg, &argsize, 0, pFile) != -1)
{
strncpy(buffer, arg, size);
buffer[size-1] = '\0';
break;
if (bNextIsGame)
{
strncpy(buffer, arg, size);
buffer[size-1] = '\0';
break;
}
if (strcmp(arg, "-game") == 0)
{
bNextIsGame = true;
}
}
if (strcmp(arg, "-game") == 0)
{
bNextIsGame = true;
}
free(arg);
fclose(pFile);
}
free(arg);
fclose(pFile);
#else
#error unsupported platform
#endif