mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Avoid some hardcoded string sizes
This commit is contained in:
parent
00b4cbafd0
commit
3c3d20601b
4 changed files with 15 additions and 15 deletions
|
|
@ -270,7 +270,7 @@ extern int exit_sync_needed;
|
|||
#define SMARTCTL_FLAG_SELFERROR_LOGGED (1 << 7) /**< The device self-test log contains records of errors. */
|
||||
|
||||
/**
|
||||
* SMART max attribute length.
|
||||
* SMART max attribute name or value length.
|
||||
*/
|
||||
#define SMART_MAX 128
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ extern int exit_sync_needed;
|
|||
#define SMART_ATTR_WHEN_FAILED_NEVER 64
|
||||
|
||||
struct smart_attr {
|
||||
char name[128]; /**< SMART attribute name. */
|
||||
char name[SMART_MAX]; /**< SMART attribute name. */
|
||||
uint64_t raw; /**< SMART attributes raw. It can be SMART_UNASSIGNED. */
|
||||
uint64_t norm; /**< SMART attributes normalized. It can be SMART_UNASSIGNED even if raw is not. */
|
||||
uint64_t worst; /**< SMART attributes worst. It can be SMART_UNASSIGNED even if raw/norm is not. */
|
||||
|
|
|
|||
|
|
@ -583,9 +583,9 @@ static void state_smart_log(devinfo_t* devinfo, double afr)
|
|||
else if (attr->flags & SMART_ATTR_WHEN_FAILED_NEVER)
|
||||
when_failed = "never";
|
||||
|
||||
char norm[64] = { 0 };
|
||||
char worst[64] = { 0 };
|
||||
char thresh[64] = { 0 };
|
||||
char norm[SMART_MAX] = { 0 };
|
||||
char worst[SMART_MAX] = { 0 };
|
||||
char thresh[SMART_MAX] = { 0 };
|
||||
|
||||
if (attr->norm != SMART_UNASSIGNED)
|
||||
snprintf(norm, sizeof(norm), "%" PRIu64, attr->norm);
|
||||
|
|
|
|||
|
|
@ -2631,13 +2631,13 @@ int smartctl_attribute(OS_FILE* f, const char* file, const char* name, struct sm
|
|||
} else if (smatch(s, "ID#") == 0) {
|
||||
inside = 1;
|
||||
} else if (inside) {
|
||||
char id_name[128] = { 0 };
|
||||
char type[64] = { 0 };
|
||||
char updated[64] = { 0 };
|
||||
char when_failed[64] = { 0 };
|
||||
char norm[64] = { 0 };
|
||||
char worst[64] = { 0 };
|
||||
char thresh[64] = { 0 };
|
||||
char id_name[SMART_MAX] = { 0 };
|
||||
char type[SMART_MAX] = { 0 };
|
||||
char updated[SMART_MAX] = { 0 };
|
||||
char when_failed[SMART_MAX] = { 0 };
|
||||
char norm[SMART_MAX] = { 0 };
|
||||
char worst[SMART_MAX] = { 0 };
|
||||
char thresh[SMART_MAX] = { 0 };
|
||||
uint64_t min, max, avg;
|
||||
int format_minmax = 0;
|
||||
int format_avg = 0;
|
||||
|
|
|
|||
|
|
@ -3692,9 +3692,9 @@ int ambient_temperature(void)
|
|||
|
||||
while ((hwmon_entry = readdir(hwmon_dir)) != NULL) {
|
||||
char hwmon_name[PATH_MAX];
|
||||
char value[128];
|
||||
char name[128];
|
||||
char label[128];
|
||||
char value[SMART_MAX];
|
||||
char name[SMART_MAX];
|
||||
char label[SMART_MAX];
|
||||
char* dash;
|
||||
char* e;
|
||||
int temp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue