mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 02:25:09 +00:00
Use strtol in preference to atoi for cpugovernor.
This commit is contained in:
parent
bebf3f2bef
commit
9eb075d8dc
@ -456,13 +456,13 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
#if defined(__linux__)
|
||||
END OBJ(cpugovernor, nullptr) get_cpu_count();
|
||||
if ((arg == nullptr) || (isdigit(static_cast<unsigned char>(arg[0])) == 0) ||
|
||||
strlen(arg) >= 3 || atoi(&arg[0]) == 0 ||
|
||||
static_cast<unsigned int>(atoi(&arg[0])) > info.cpu_count) {
|
||||
strlen(arg) >= 3 || strtol(&arg[0], nullptr, 10) == 0 ||
|
||||
static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) > info.cpu_count) {
|
||||
obj->data.i = 1;
|
||||
/* NORM_ERR("cpugovernor: Invalid CPU number or you don't have that "
|
||||
"many CPUs! Displaying the scaling governor for CPU 1."); */
|
||||
} else {
|
||||
obj->data.i = atoi(&arg[0]);
|
||||
obj->data.i = strtol(&arg[0], nullptr, 10);
|
||||
}
|
||||
obj->callbacks.print = &print_cpugovernor;
|
||||
#endif /* __linux__ */
|
||||
|
Loading…
Reference in New Issue
Block a user