Skip to content

Commit d218102

Browse files
committed
some fixes
Signed-off-by: kernaltrap <[email protected]>
1 parent fe19744 commit d218102

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/tinyfetch.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <string.h>
2020
#include <sys/utsname.h>
2121
#include <unistd.h>
22+
#include <stdbool.h>
2223
#ifdef __linux__
2324
#include <linux/kernel.h>
2425
#include <sys/sysinfo.h>
@@ -122,7 +123,7 @@ ParserResult file_parser(const char *file, const char *line_to_read,
122123
*/
123124

124125
char *get_hostname(void) {
125-
char hostname[256];
126+
char hostname[HOST_NAME_MAX];
126127
if (gethostname(hostname, sizeof(hostname)) ==
127128
0) { // if the gethostname command works, return the value from it.
128129
// otherise return a nullptr.
@@ -671,10 +672,7 @@ void tinyascii(char *TinyfetchUserSpecifiedDistroChar) {
671672
void tinyuser(void) {
672673
tinyinit();
673674
// char *user = getenv("USER");
674-
char *buf;
675-
buf = (char *)malloc(10 * sizeof(char));
676-
buf = getlogin();
677-
char *user = buf;
675+
char *user = getlogin();
678676
printf("%s@", user); // username@, username is taken from char* user
679677
if (user != NULL) {
680678
int total_length = strlen(user) + strlen(tiny.nodename) + 1;

src/tinyfetch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/*
77
tinyfetch.h
88
*/
9-
#define VERSION "6.8"
9+
#define VERSION "6.8a"
1010
#define decoration "[·]"
1111
#define CMDLINE_PATH "/proc/%d/cmdline"
1212
#define help_banner \

0 commit comments

Comments
 (0)