lakka_get_project() function - cleanup

This commit is contained in:
twinaphex 2016-11-16 07:17:04 +01:00
parent d745891b14
commit a912d7176f

View File

@ -87,12 +87,15 @@ static char lakka_project[128];
static char *lakka_get_project(void)
{
FILE *command_file = NULL;
command_file = popen("cat /etc/release | cut -d - -f 1", "r");
size_t len;
FILE *command_file = popen("cat /etc/release | cut -d - -f 1", "r");
fgets(lakka_project, sizeof(lakka_project), command_file);
size_t len = strlen(lakka_project);
len = strlen(lakka_project);
if (len > 0 && lakka_project[len-1] == '\n')
lakka_project[--len] = '\0';
pclose(command_file);
return lakka_project;
}