Obsolete
/
libipc-old
Archived
3
0
Fork 0

buffers don't require malloc anymore

pollfd
Karchnu 2020-07-08 01:08:00 +02:00
parent 98a1389376
commit 90a51a7ed7
1 changed files with 5 additions and 6 deletions

View File

@ -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) struct ipc_error ipc_write_fd (int fd, const struct ipc_message *m)
{ {
char *buf = NULL;
size_t msize = 0; 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; 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 // what was sent != what should have been sent
T_R ((nbytes_sent != msize), IPC_ERROR_WRITE_FD__NOT_ENOUGH_DATA); T_R ((nbytes_sent != msize), IPC_ERROR_WRITE_FD__NOT_ENOUGH_DATA);