eina debug - check write return values and complain on failure

coverity - fix CID 1377521
This commit is contained in:
Carsten Haitzler 2017-09-29 11:39:39 +09:00
parent b7d4372221
commit 05b26102cf
1 changed files with 10 additions and 2 deletions

View File

@ -156,14 +156,22 @@ eina_debug_session_send(Eina_Debug_Session *session, int dest, int op, void *dat
#ifndef _WIN32
eina_spinlock_take(&_eina_debug_lock);
/* Sending header */
write(session->fd, &hdr, sizeof(hdr));
if (write(session->fd, &hdr, sizeof(hdr)) != sizeof(hdr)) goto err;
/* Sending payload */
if (size) write(session->fd, data, size);
if (size)
{
if (write(session->fd, data, size) != size) goto err;
}
eina_spinlock_release(&_eina_debug_lock);
#else
(void)data;
#endif
return size;
#ifndef _WIN32
err:
e_debug("Cannot write to eina debug session");
return 0;
#endif
}
#ifndef _WIN32