From 5f0b2ece161b16321792d9ff2f76bcc33a3b6b42 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 23 Nov 2009 08:03:35 +0200 Subject: [PATCH] Avoid compiler warnings due to ignored write return values Glibc (at least) provides the warn_unused_result attribute on write, (if optimizing and _FORTIFY_SOURCE is defined). So we explicitly ignore the return value in our signal handler, where we couldn't do anything anyway. Compile with: make CFLAGS="-O -D_FORTIFY_SOURCE" before this commit to see the warning. --- notmuch-new.c | 4 +++- notmuch-tag.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index f58a384b..9d206167 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -35,8 +35,10 @@ static volatile sig_atomic_t interrupted; static void handle_sigint (unused (int sig)) { + ssize_t ignored; static char msg[] = "Stopping... \n"; - write(2, msg, sizeof(msg)-1); + + ignored = write(2, msg, sizeof(msg)-1); interrupted = 1; } diff --git a/notmuch-tag.c b/notmuch-tag.c index 07cb8c5f..00588a11 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -25,8 +25,10 @@ static volatile sig_atomic_t interrupted; static void handle_sigint (unused (int sig)) { + ssize_t ignored; + static char msg[] = "Stopping... \n"; - write(2, msg, sizeof(msg)-1); + ignored = write(2, msg, sizeof(msg)-1); interrupted = 1; } -- 2.26.2