diff --git a/cmdline/mingwapp.c b/cmdline/mingwapp.c index daa68396..28a4bace 100644 --- a/cmdline/mingwapp.c +++ b/cmdline/mingwapp.c @@ -898,9 +898,9 @@ static int devsmart(uint64_t device, const char* name, const char* smartctl, con if (smartctl[0]) { char option[SMART_MAX]; snprintf(option, sizeof(option), smartctl, file); - snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" %s %s", windows_exedir(), info_opts, option); + snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" %s %s", windows_exedir(), info_opts, option); } else { - snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" %s %s", windows_exedir(), info_opts, file); + snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" %s %s", windows_exedir(), info_opts, file); } count = 0; @@ -956,7 +956,7 @@ retry: && info[INFO_ROTATION_RATE] == SMART_UNASSIGNED ) { /* retry using the "sat" type */ - snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" %s -d sat %s", windows_exedir(), info_opts, file); + snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" %s -d sat %s", windows_exedir(), info_opts, file); ++count; goto retry; @@ -1222,9 +1222,9 @@ static int devprobe(uint64_t device, const char* name, const char* smartctl, con if (smartctl[0]) { char option[SMART_MAX]; snprintf(option, sizeof(option), smartctl, file); - snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -n standby,3 %s %s", windows_exedir(), info_opts, option); + snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -n standby,3 %s %s", windows_exedir(), info_opts, option); } else { - snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -n standby,3 %s %s", windows_exedir(), info_opts, file); + snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -n standby,3 %s %s", windows_exedir(), info_opts, file); } count = 0; @@ -1273,7 +1273,7 @@ retry: */ if (ret == 2) { /* retry using the "sat" type */ - snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -n standby,3 %s -d sat %s", windows_exedir(), info_opts, file); + snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -n standby,3 %s -d sat %s", windows_exedir(), info_opts, file); ++count; goto retry; @@ -1313,9 +1313,9 @@ static int devdown(uint64_t device, const char* name, const char* smartctl) if (smartctl[0]) { char option[SMART_MAX]; snprintf(option, sizeof(option), smartctl, file); - snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -s standby,now %s", windows_exedir(), option); + snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -s standby,now %s", windows_exedir(), option); } else { - snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -s standby,now %s", windows_exedir(), file); + snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -s standby,now %s", windows_exedir(), file); } count = 0; @@ -1364,7 +1364,7 @@ retry: */ if (ret == 2) { /* retry using the "sat" type */ - snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -s standby,now -d sat %s", windows_exedir(), file); + snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -s standby,now -d sat %s", windows_exedir(), file); ++count; goto retry;