mirror of
https://github.com/lxsang/sysmond.git
synced 2024-11-08 06:28:27 +01:00
fix: over flow bugs in temperature reading
All checks were successful
gitea-sync/sysmond/pipeline/head This commit looks good
All checks were successful
gitea-sync/sysmond/pipeline/head This commit looks good
This commit is contained in:
parent
7cc9c5fdbe
commit
8a5eb8649e
8
sysmon.c
8
sysmon.c
@ -87,8 +87,8 @@ typedef struct
|
|||||||
{
|
{
|
||||||
char cpu_temp_file[MAX_BUF];
|
char cpu_temp_file[MAX_BUF];
|
||||||
char gpu_temp_file[MAX_BUF];
|
char gpu_temp_file[MAX_BUF];
|
||||||
uint16_t cpu;
|
uint32_t cpu;
|
||||||
uint16_t gpu;
|
uint32_t gpu;
|
||||||
} sys_temp_t;
|
} sys_temp_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -377,7 +377,7 @@ static int read_mem_info(app_data_t *opts)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_temp_file(const char *file, uint16_t *output)
|
static int read_temp_file(const char *file, uint32_t *output)
|
||||||
{
|
{
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
if (file[0] != '\0')
|
if (file[0] != '\0')
|
||||||
@ -396,7 +396,7 @@ static int read_temp_file(const char *file, uint16_t *output)
|
|||||||
(void)close(fd);
|
(void)close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*output = (uint16_t)atoi(buf);
|
*output = (uint32_t)atoi(buf);
|
||||||
(void)close(fd);
|
(void)close(fd);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user