comparison cli-agentfwd.c @ 1057:16584026a1f0 nocircbuffer

allocate buffer and data in a single allocation
author Matt Johnston <matt@ucc.asn.au>
date Sun, 01 Mar 2015 21:16:09 +0800
parents 9bf46570868f
children 750ec4ec4cbe
comparison
equal deleted inserted replaced
1056:a2bfd4374878 1057:16584026a1f0
153 if (readlen > MAX_AGENT_REPLY) { 153 if (readlen > MAX_AGENT_REPLY) {
154 TRACE(("agent reply is too big")); 154 TRACE(("agent reply is too big"));
155 goto out; 155 goto out;
156 } 156 }
157 157
158 buf_resize(inbuf, readlen); 158 inbuf = buf_resize(inbuf, readlen);
159 buf_setpos(inbuf, 0); 159 buf_setpos(inbuf, 0);
160 ret = atomicio(read, fd, buf_getwriteptr(inbuf, readlen), readlen); 160 ret = atomicio(read, fd, buf_getwriteptr(inbuf, readlen), readlen);
161 if ((size_t)ret != readlen) { 161 if ((size_t)ret != readlen) {
162 TRACE(("read of data failed for agent_request")) 162 TRACE(("read of data failed for agent_request"))
163 goto out; 163 goto out;