Optimize the code that copies strings
[fio.git] / engines / sg.c
index c46b9abaec871e5b97e599f276620bb9e001eaaa..a1a6de4ce248dd680dc9d2f709479422de24b6de 100644 (file)
@@ -1181,8 +1181,8 @@ static char *fio_sgio_errdetails(struct io_u *io_u)
        }
 
        if (!(hdr->info & SG_INFO_CHECK) && !strlen(msg))
-               strncpy(msg, "SG Driver did not report a Host, Driver or Device check",
-                       MAXERRDETAIL - 1);
+               snprintf(msg, MAXERRDETAIL, "%s",
+                        "SG Driver did not report a Host, Driver or Device check");
 
        return msg;
 }