Ensure we have enough room for the ETA runstr
[fio.git] / server.c
index f65f3abfc87339211c72302e0ed7f36243382ed9..e20f5921b6b4994f30fef52ab3a75235db7a16cd 100644 (file)
--- a/server.c
+++ b/server.c
@@ -555,6 +555,7 @@ static int handle_run_cmd(struct flist_head *job_list, struct fio_net_cmd *cmd)
        pid_t pid;
        int ret;
 
+       fio_time_init();
        set_genesis_time();
 
        pid = fork();
@@ -672,7 +673,7 @@ static int handle_send_eta_cmd(struct fio_net_cmd *cmd)
        if (!thread_number)
                return 0;
 
-       size = sizeof(*je) + thread_number * sizeof(char) + 1;
+       size = sizeof(*je) + THREAD_RUNSTR_SZ;
        je = malloc(size);
        memset(je, 0, size);
 
@@ -1225,7 +1226,9 @@ int fio_send_iolog(struct thread_data *td, struct io_log *log, const char *name)
        pdu.nr_samples = __cpu_to_le32(log->nr_samples);
        pdu.log_type = cpu_to_le32(log->log_type);
        pdu.compressed = cpu_to_le32(use_zlib);
-       strcpy((char *) pdu.name, name);
+
+       strncpy((char *) pdu.name, name, FIO_NET_NAME_MAX);
+       pdu.name[FIO_NET_NAME_MAX - 1] = '\0';
 
        for (i = 0; i < log->nr_samples; i++) {
                struct io_sample *s = &log->log[i];