again slightly less dumb

This commit is contained in:
2026-06-24 21:04:00 +02:00
parent 42f702ca1b
commit f7ed895f3b

View File

@@ -87,7 +87,7 @@ int get_hwmon_dir(char *path, const size_t bufsz) {
inline size_t read_file(const char *dir, const char *file, char *buffer, const size_t n) {
char path[160]; // bug alert
char *nt = stpcpy(path, dir); // nt is a pointer to the null terminator of the copied string
stpcpy(nt, file); // write at the null terminator address, aka append to the end
strcpy(nt, file); // copy to the null terminator of prev copy, append basically
const int fd = open(path, O_RDONLY | O_CLOEXEC);
if (fd < 0) {
if (buffer != NULL) // if its null means we're just checking if it exists at all, so dont log it