Permalink
Browse files

Fix linux build.

  • Loading branch information...
psychonic committed Oct 24, 2013
1 parent fdcbe71 commit 2bd02e10e7db7270d39805fef858f47c608cfd37
Showing with 19 additions and 20 deletions.
  1. +19 −20 loader/loader.cpp
View
@@ -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)
{
strncpy(buffer, arg, size);
buffer[size-1] = '\0';
break;
}
char *arg = NULL;
size_t argsize = 0;
bool bNextIsGame = false;
if (strcmp(arg, "-game") == 0)
while (getdelim(&arg, &argsize, 0, pFile) != -1)
{
bNextIsGame = true;
}
}
if (bNextIsGame)
{
strncpy(buffer, arg, size);
buffer[size-1] = '\0';
break;
}
free(arg);
fclose(pFile);
if (strcmp(arg, "-game") == 0)
{
bNextIsGame = true;
}
}
free(arg);
fclose(pFile);
}
#else
#error unsupported platform
#endif

0 comments on commit 2bd02e1

Please sign in to comment.