Little fix for previous commit

This commit is contained in:
TheDarkBug 2021-07-21 22:45:16 +02:00
parent b86783c774
commit c0eb27037c
2 changed files with 7 additions and 3 deletions

View file

@ -1,7 +1,7 @@
NAME = uwufetch NAME = uwufetch
FILES = uwufetch.c FILES = uwufetch.c
CFLAGS = -O3 CFLAGS = -O3
CFLAGS_DEBUG = -Wall -Wextra -g -thread CFLAGS_DEBUG = -Wall -Wextra -g -pthread
ifeq ($(shell uname), Linux) ifeq ($(shell uname), Linux)
PREFIX = /usr/bin PREFIX = /usr/bin
LIBDIR = /usr/lib LIBDIR = /usr/lib

View file

@ -378,7 +378,9 @@ void get_info()
// os version, cpu and board info // os version, cpu and board info
FILE *os_release = fopen("/etc/os-release", "r"); FILE *os_release = fopen("/etc/os-release", "r");
#ifndef __FREEBSD__
FILE *cpuinfo = fopen("/proc/cpuinfo", "r"); FILE *cpuinfo = fopen("/proc/cpuinfo", "r");
#endif
FILE *host_model_info = fopen("/sys/devices/virtual/dmi/id/product_version", "r"); FILE *host_model_info = fopen("/sys/devices/virtual/dmi/id/product_version", "r");
#ifdef __CYGWIN__ #ifdef __CYGWIN__
iscygwin = 1; iscygwin = 1;
@ -400,10 +402,12 @@ void get_info()
break; break;
} }
} }
#ifndef __FREEBSD__
while (fgets(line, sizeof(line), cpuinfo)) while (fgets(line, sizeof(line), cpuinfo))
if (sscanf(line, "model name : %[^\n]", cpu_model)) if (sscanf(line, "model name : %[^\n]", cpu_model))
break; break;
sprintf(user, "%s", getenv("USER")); sprintf(user, "%s", getenv("USER"));
#endif
if (iscygwin == 0) if (iscygwin == 0)
fclose(os_release); fclose(os_release);
} }