File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -267,20 +267,16 @@ ssize_t XVC_client::xfer_pkt(const string &instr,
267267 uint8_t *rx, uint32_t rx_size)
268268{
269269 ssize_t len = tx_size;
270+ vector<uint8_t > buffer (instr.size () + (tx) ? tx_size : 0 );
271+ memcpy (buffer.data (), instr.c_str (), instr.size ());
272+ if (tx)
273+ memcpy (buffer.data () + instr.size (), tx, tx_size);
270274
271- /* 1. instruction */
272- if (sendall (_sock, instr.c_str (), instr.size (), 0 ) == -1 ) {
273- printError (" Send instruction failed" );
275+ if (sendall (_sock, buffer.data (), buffer.size (), 0 ) == -1 ) {
276+ printError (" Send failed" );
274277 return -1 ;
275278 }
276279
277- if (tx) {
278- if (sendall (_sock, tx, tx_size, 0 ) == -1 ) {
279- printError (" Send error" );
280- return -1 ;
281- }
282- }
283-
284280 if (rx) {
285281 len = recv (_sock, rx, rx_size, 0 );
286282 if (len < 0 ) {
You can’t perform that action at this time.
0 commit comments