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)
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)
159 if (sdata.sig >= 0) 159 if (sdata.sig >= 0)
160 { 160 {
161 int err = errno; 161 int err = errno;
162 write(sig_pipe[1], &sdata, sizeof(sdata)); 162 const ssize_t bytes = write(sig_pipe[1], &sdata, sizeof(sdata));
163 if (EINA_UNLIKELY(bytes != sizeof(sdata)))
164 {
165 err = errno;
166 ERR("write() failed: %s", strerror(err));
167 }
163 errno = err; 168 errno = err;
164 } 169 }
165} 170}