paleofetch

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit f6ae146cd891240813f4d609dfddc1f0d84f81f1
parent 24b08dce4b2dba6b9f9d3286751def9b497af6fc
Author: sam-barr <samfbarr@outlook.com>
Date:   Thu, 23 Apr 2020 21:08:12 -0500

Merge branch 'master' of https://github.com/sam-barr/paleofetch

Diffstat:
Mpaleofetch.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/paleofetch.c b/paleofetch.c @@ -105,14 +105,20 @@ char *get_bar() { char *get_os() { char *os = malloc(BUF_SIZE), - *name = malloc(BUF_SIZE); + *name = malloc(BUF_SIZE), + *line = NULL; + size_t len; FILE *os_release = fopen("/etc/os-release", "r"); if(os_release == NULL) { status = -1; halt_and_catch_fire("unable to open /etc/os-release"); } - fscanf(os_release, "NAME=\"%[^\"]+", name); + while (getline(&line, &len, os_release) != -1) { + if (sscanf(line, "NAME=\"%[^\"]+", name) > 0) break; + } + + free(line); fclose(os_release); snprintf(os, BUF_SIZE, "%s %s", name, uname_info.machine); free(name);