summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean@guyomarch.bzh>2018-02-25 10:40:50 +0100
committerJean Guyomarc'h <jean@guyomarch.bzh>2018-02-25 10:40:50 +0100
commit87efca57ef942adbe66decd049bf31f17af29143 (patch)
tree701125143c9c03282e6d41076ef00949aae60c33
parent7ff60afe5c164f0a10b3c9fbdf405c364d91b0d5 (diff)
downloadefl-87efca57ef942adbe66decd049bf31f17af29143.tar.gz
ecore_signal: check the return value of write(2)
Some glibc declare write(2) with the attribute warn unused result. So we now ensure that the calls to write(2) are successful. Otherwise, we print an error and update errno accordingly.
-rw-r--r--src/lib/ecore/ecore_signal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/ecore/ecore_signal.c b/src/lib/ecore/ecore_signal.c
index cfaf76b899..b40ad3db70 100644
--- a/src/lib/ecore/ecore_signal.c
+++ b/src/lib/ecore/ecore_signal.c
@@ -159,7 +159,12 @@ _ecore_signal_callback(int sig, siginfo_t *si, void *foo EINA_UNUSED)
if (sdata.sig >= 0)
{
int err = errno;
- write(sig_pipe[1], &sdata, sizeof(sdata));
+ const ssize_t bytes = write(sig_pipe[1], &sdata, sizeof(sdata));
+ if (EINA_UNLIKELY(bytes != sizeof(sdata)))
+ {
+ err = errno;
+ ERR("write() failed: %s", strerror(err));
+ }
errno = err;
}
}