fio: Eliminate compilation warning in ppc
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index 1ef88ddf69884b083c229032c08fb9df8b6f63cb..3adb46eab8087cc53ae0fd2b7c15ad048596c040 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1272,10 +1272,12 @@ static void __show_run_stats(void)
                        if (!td->error && td->o.continue_on_error &&
                            td->first_error) {
                                ts->error = td->first_error;
-                               strcpy(ts->verror, td->verror);
+                               ts->verror[sizeof(ts->verror) - 1] = '\0';
+                               strncpy(ts->verror, td->verror, sizeof(ts->verror) - 1);
                        } else  if (td->error) {
                                ts->error = td->error;
-                               strcpy(ts->verror, td->verror);
+                               ts->verror[sizeof(ts->verror) - 1] = '\0';
+                               strncpy(ts->verror, td->verror, sizeof(ts->verror) - 1);
                        }
                }
 
@@ -1471,7 +1473,12 @@ void show_running_run_stats(void)
        fio_mutex_down(stat_mutex);
 
        if (!pthread_create(&thread, NULL, __show_running_run_stats, NULL)) {
-               pthread_detach(thread);
+               int err;
+
+               err = pthread_detach(thread);
+               if (err)
+                       log_err("fio: DU thread detach failed: %s\n", strerror(err));
+
                return;
        }