From: Carsten Haitzler (Rasterman) Date: Fri, 29 Sep 2017 02:39:39 +0000 (+0900) Subject: eina debug - check write return values and complain on failure X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~2421 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05b26102cfebc6e64716df4b428f86e2c3e52fcc;p=platform%2Fupstream%2Fefl.git eina debug - check write return values and complain on failure coverity - fix CID 1377521 --- diff --git a/src/lib/eina/eina_debug.c b/src/lib/eina/eina_debug.c index b042a16..8bc8059 100644 --- a/src/lib/eina/eina_debug.c +++ b/src/lib/eina/eina_debug.c @@ -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