diff options
author | Jean Guyomarc'h <jean@guyomarch.bzh> | 2018-02-25 10:40:50 +0100 |
---|---|---|
committer | Jean Guyomarc'h <jean@guyomarch.bzh> | 2018-02-25 10:40:50 +0100 |
commit | 87efca57ef942adbe66decd049bf31f17af29143 (patch) | |
tree | 701125143c9c03282e6d41076ef00949aae60c33 | |
parent | 7ff60afe5c164f0a10b3c9fbdf405c364d91b0d5 (diff) | |
download | efl-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.c | 7 |
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; } } |