SysArchMeter: skip "n/a" values

Unavailable values are returned as "n/a" from lsb_release, skip these.

$ lsb_release -a
LSB Version:    1.4
Distributor ID: Arch
Description:    Arch Linux
Release:        rolling
Codename:       n/a
This commit is contained in:
Christian Hesse 2021-02-04 13:26:39 +01:00
parent 8fb51627b2
commit 85a855f5b2
1 changed files with 5 additions and 0 deletions

View File

@ -38,6 +38,11 @@ static void SysArchMeter_updateValues(Meter* this, char* buffer, size_t size) {
char* value = String_trim(&line[n + 1]); char* value = String_trim(&line[n + 1]);
line[n] = '\0'; line[n] = '\0';
if(String_eq(value, "n/a")) {
free(value);
continue;
}
if(String_eq(line, "Distributor ID")) if(String_eq(line, "Distributor ID"))
snprintf(distro[0], sizeof(distro[0]), "%s", value); snprintf(distro[0], sizeof(distro[0]), "%s", value);
else if(String_eq(line, "Release")) else if(String_eq(line, "Release"))