mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-14 03:23:29 +00:00
relying on the return value of scanf when using %n is bad
This commit is contained in:
parent
5d69d0378f
commit
580043075e
@ -1336,8 +1336,8 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(buffers, INFO_BUFFERS)
|
||||
END OBJ(cached, INFO_BUFFERS)
|
||||
#define SCAN_CPU(__arg, __var) { \
|
||||
int __offset; \
|
||||
if (__arg && sscanf(__arg, " cpu%u %n", &__var, &__offset) == 2) \
|
||||
int __offset = 0; \
|
||||
if (__arg && sscanf(__arg, " cpu%u %n", &__var, &__offset) > 0) \
|
||||
__arg += __offset; \
|
||||
else \
|
||||
__var = 0; \
|
||||
|
Loading…
Reference in New Issue
Block a user