From 70f246013067158dff1809d4074d3e35cca6aeb5 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Wed, 26 Sep 2018 06:50:43 +0200 Subject: [PATCH] Fix some warnings with latest gcc 8.2.0 --- cmdline/unix.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmdline/unix.c b/cmdline/unix.c index d3193154..351cfba4 100644 --- a/cmdline/unix.c +++ b/cmdline/unix.c @@ -1074,8 +1074,8 @@ static int devscan(tommy_list* list) #if HAVE_LINUX_DEVICE static int devsmart(dev_t device, const char* name, const char* custom, uint64_t* smart, char* serial, char* vendor, char* model) { - char cmd[128]; - char file[128]; + char cmd[PATH_MAX + 64]; + char file[PATH_MAX]; FILE* f; int ret; @@ -1088,7 +1088,7 @@ static int devsmart(dev_t device, const char* name, const char* custom, uint64_t /* if there is a custom command */ if (custom[0]) { - char option[128]; + char option[PATH_MAX]; snprintf(option, sizeof(option), custom, file); snprintf(cmd, sizeof(cmd), "smartctl -a %s", option); } else { @@ -1142,8 +1142,8 @@ static int devsmart(dev_t device, const char* name, const char* custom, uint64_t #if HAVE_LINUX_DEVICE static int devdown(dev_t device, const char* name, const char* custom) { - char cmd[128]; - char file[128]; + char cmd[PATH_MAX + 64]; + char file[PATH_MAX]; FILE* f; int ret; @@ -1156,7 +1156,7 @@ static int devdown(dev_t device, const char* name, const char* custom) /* if there is a custom command */ if (custom[0]) { - char option[128]; + char option[PATH_MAX]; snprintf(option, sizeof(option), custom, file); snprintf(cmd, sizeof(cmd), "smartctl -s standby,now %s", option); } else {