ncneofetch: don't read from NULL cpuinfo FILE

This commit is contained in:
nick black 2020-06-21 02:53:40 -04:00
parent 0ad87ef8bb
commit c7c0909c17
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -63,6 +63,10 @@ static distro_info distros[] = {
static int
fetch_cpu_info(fetched_info* fi){
FILE* cpuinfo = fopen("/proc/cpuinfo", "re");
if(cpuinfo == NULL){
fprintf(stderr, "Error opening /proc/cpuinfo (%s)\n", strerror(errno));
return -1;
}
char buf[BUFSIZ];
while(fgets(buf, sizeof(buf), cpuinfo)){
#define TAG "model name\t:"