Pass more arguments to fio_init_net_cmd()
[fio.git] / server.c
index 4a78f38396c2a2eb0fc99808d565288c7e695705..8bbac70f2225fedd7399db511ea9b4b7a4f3f5d8 100644 (file)
--- a/server.c
+++ b/server.c
@@ -143,7 +143,6 @@ struct fio_net_cmd *fio_net_cmd_read(int sk)
                return NULL;
        }
 
-
        return ret;
 }
 
@@ -374,11 +373,7 @@ int fio_server_text_output(const char *buf, unsigned int len)
        int size = sizeof(*cmd) + len;
 
        cmd = malloc(size);
-       fio_init_net_cmd(cmd);
-       cmd->opcode     = cpu_to_le16(FIO_NET_CMD_TEXT);
-       cmd->pdu_len    = cpu_to_le32(len);
-       memcpy(&cmd->payload, buf, len);
-
+       fio_init_net_cmd(cmd, FIO_NET_CMD_TEXT, buf, len);
        fio_net_cmd_crc(cmd);
 
        fio_send_data(server_fd, cmd, size);
@@ -392,7 +387,7 @@ int fio_server_log(const char *format, ...)
        va_list args;
 
        va_start(args, format);
-       sprintf(buffer, format, args);
+       snprintf(buffer, sizeof(buffer), format, args);
        va_end(args);
 
        return fio_server_text_output(buffer, strlen(buffer));