This commit is contained in:
TheDarkBug 2022-02-05 14:22:57 +01:00
parent c583ec9d62
commit ad522fbffb

View file

@ -949,6 +949,11 @@ struct info get_info()
if (os_release) { // get normal vars if os_release exists if (os_release) { // get normal vars if os_release exists
while (fgets(buffer, sizeof(buffer), os_release) && !(sscanf(buffer, "\nID=\"%s\"", user_info.os_name) || sscanf(buffer, "\nID=%s", user_info.os_name))) while (fgets(buffer, sizeof(buffer), os_release) && !(sscanf(buffer, "\nID=\"%s\"", user_info.os_name) || sscanf(buffer, "\nID=%s", user_info.os_name)))
; ;
// sometimes for some reason sscanf reads the last '\"' too
int os_name_len = strlen(user_info.os_name);
if (user_info.os_name[os_name_len - 1] == '\"') {
user_info.os_name[os_name_len - 1] = '\0';
}
/* trying to detect amogos because in its os-release file ID value is just "debian", /* trying to detect amogos because in its os-release file ID value is just "debian",
will be removed when amogos will have an os-release file with ID=amogos */ will be removed when amogos will have an os-release file with ID=amogos */
if (strcmp(user_info.os_name, "debian") == 0 || strcmp(user_info.os_name, "raspbian") == 0) { if (strcmp(user_info.os_name, "debian") == 0 || strcmp(user_info.os_name, "raspbian") == 0) {