Patchwork [02/14] posix-aio-compat.c: fix warning with _FORTIFY_SOURCE

login
register
mail settings
Submitter Kirill A. Shutemov
Date Dec. 31, 2009, 1:33 a.m.
Message ID <1262223199-19062-2-git-send-email-kirill@shutemov.name>
Download mbox | patch
Permalink /patch/41947/
State New
Headers show

Comments

Kirill A. Shutemov - Dec. 31, 2009, 1:33 a.m.
CC    posix-aio-compat.o
cc1: warnings being treated as errors
posix-aio-compat.c: In function 'aio_signal_handler':
posix-aio-compat.c:505: error: ignoring return value of 'write', declared with attribute warn_unused_result
make: *** [posix-aio-compat.o] Error 1

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 posix-aio-compat.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Patch

diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index dc14f53..e0d71fa 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -501,8 +501,11 @@  static void aio_signal_handler(int signum)
 {
     if (posix_aio_state) {
         char byte = 0;
+        int ret;
 
-        write(posix_aio_state->wfd, &byte, sizeof(byte));
+        ret = write(posix_aio_state->wfd, &byte, sizeof(byte));
+        if (ret < 0 && errno != EAGAIN)
+            die("write()");
     }
 
     qemu_service_io();