buffers don't require malloc anymore
parent
98a1389376
commit
90a51a7ed7
|
@ -190,16 +190,15 @@ struct ipc_error ipc_read (const struct ipc_ctx *ctx, uint32_t index, struct ipc
|
|||
|
||||
struct ipc_error ipc_write_fd (int fd, const struct ipc_message *m)
|
||||
{
|
||||
char *buf = NULL;
|
||||
size_t msize = 0;
|
||||
ipc_message_format_write (m, &buf, &msize);
|
||||
SECURE_BUFFER_DECLARATION (char, buf, IPC_MAX_MESSAGE_SIZE);
|
||||
char *pbuf = buf;
|
||||
|
||||
ipc_message_format_write (m, &pbuf, &msize);
|
||||
|
||||
size_t nbytes_sent = 0;
|
||||
TEST_IPC_RETURN_ON_ERROR_FREE (usock_send (fd, buf, msize, &nbytes_sent), buf);
|
||||
TEST_IPC_RETURN_ON_ERROR (usock_send (fd, buf, msize, &nbytes_sent));
|
||||
|
||||
if (buf != NULL) {
|
||||
free (buf);
|
||||
}
|
||||
// what was sent != what should have been sent
|
||||
T_R ((nbytes_sent != msize), IPC_ERROR_WRITE_FD__NOT_ENOUGH_DATA);
|
||||
|
||||
|
|
Reference in New Issue