Make temp more readable on Linux
Aaron Marcher me@drkhsh.at
Sun, 20 May 2018 00:30:16 +0200
1 files changed,
5 insertions(+),
2 deletions(-)
jump to
M
components/temperature.c
→
components/temperature.c
@@ -9,8 +9,11 @@ temp(const char *file)
{ int temp; - return (pscanf(file, "%d", &temp) == 1) ? - bprintf("%d°C", temp / 1000) : NULL; + if(pscanf(file, "%d", &temp) != 1) { + return NULL; + } + + return bprintf("%d°C", temp / 1000); } #elif defined(__OpenBSD__) #include <errno.h>