sysinfo: Lower priority of make.conf for distro name

This is used elsewhere other than Gentoo so it is a rather
unreliable check compared to lsb-release.
This commit is contained in:
Lance Poore 2017-04-28 07:44:55 -04:00 committed by Patrick Griffis
parent 88cb0c9d20
commit 92496b183e
1 changed files with 13 additions and 13 deletions

View File

@ -256,19 +256,7 @@ int xs_parse_distro(char *name)
FILE *fp = NULL; FILE *fp = NULL;
char buffer[bsize], *pos = NULL; char buffer[bsize], *pos = NULL;
if((fp = fopen("/etc/portage/make.conf", "r")) != NULL || if((fp = fopen("/etc/redhat-release", "r")) != NULL)
(fp = fopen("/etc/make.conf", "r")) != NULL)
{
char keywords[bsize];
while(fgets(buffer, bsize, fp) != NULL)
find_match_char(buffer, "ACCEPT_KEYWORDS", keywords);
/* cppcheck-suppress uninitvar */
if (strstr(keywords, "\"") == NULL)
g_snprintf(buffer, bsize, "Gentoo Linux (stable)");
else
g_snprintf(buffer, bsize, "Gentoo Linux %s", keywords);
}
else if((fp = fopen("/etc/redhat-release", "r")) != NULL)
fgets(buffer, bsize, fp); fgets(buffer, bsize, fp);
else if((fp = fopen("/etc/mageia-release", "r")) != NULL) else if((fp = fopen("/etc/mageia-release", "r")) != NULL)
fgets(buffer, bsize, fp); fgets(buffer, bsize, fp);
@ -302,6 +290,18 @@ int xs_parse_distro(char *name)
fgets(release, bsize, fp); fgets(release, bsize, fp);
g_snprintf(buffer, bsize, "Debian %s", release); g_snprintf(buffer, bsize, "Debian %s", release);
} }
else if((fp = fopen("/etc/portage/make.conf", "r")) != NULL ||
(fp = fopen("/etc/make.conf", "r")) != NULL)
{
char keywords[bsize];
while(fgets(buffer, bsize, fp) != NULL)
find_match_char(buffer, "ACCEPT_KEYWORDS", keywords);
/* cppcheck-suppress uninitvar */
if (strstr(keywords, "\"") == NULL)
g_snprintf(buffer, bsize, "Gentoo Linux (stable)");
else
g_snprintf(buffer, bsize, "Gentoo Linux %s", keywords);
}
else else
g_snprintf(buffer, bsize, "Unknown Distro"); g_snprintf(buffer, bsize, "Unknown Distro");
if(fp != NULL) if(fp != NULL)