[notmuch] [PATCH] fix compiler warnings

Dirk-Jan C. Binnema djcb.bulk at gmail.com
Sun Nov 22 07:11:03 PST 2009


(hopefully this is the correct way to send patches...)

With these minor changes, notmuch compiles warning-free with gcc 4.4.1

---
 notmuch-new.c   |    4 +++-
 notmuch-setup.c |   13 +++++++------
 notmuch-tag.c   |    4 +++-
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 0dd2784..88b48a6 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -36,7 +36,9 @@ static void
 handle_sigint (unused (int sig))
 {
     static char msg[] = "Stopping...         \n";
-    write(2, msg, sizeof(msg)-1);
+    if (write(2, msg, sizeof(msg)-1) < 0) {
+	    /* ignore...*/
+    }
     interrupted = 1;
 }
 
diff --git a/notmuch-setup.c b/notmuch-setup.c
index 482efd2..0d3f186 100644
--- a/notmuch-setup.c
+++ b/notmuch-setup.c
@@ -99,12 +99,13 @@ notmuch_setup_command (unused (void *ctx),
     unsigned int i;
     int is_new;
 
-#define prompt(format, ...)				\
-    do {						\
-	printf (format, ##__VA_ARGS__);			\
-	fflush (stdout);				\
-	getline (&response, &response_size, stdin);	\
-	chomp_newline (response);			\
+#define prompt(format, ...)					\
+    do {							\
+	printf (format, ##__VA_ARGS__);				\
+	fflush (stdout);					\
+	if (getline (&response, &response_size, stdin) < 0)	\
+		break;						\
+	chomp_newline (response);				\
     } while (0)
 
     config = notmuch_config_open (ctx, NULL, &is_new);
diff --git a/notmuch-tag.c b/notmuch-tag.c
index e2311f6..5e40f50 100644
--- a/notmuch-tag.c
+++ b/notmuch-tag.c
@@ -26,7 +26,9 @@ static void
 handle_sigint (unused (int sig))
 {
     static char msg[] = "Stopping...         \n";
-    write(2, msg, sizeof(msg)-1);
+    if (write(2, msg, sizeof(msg)-1) < 0) {
+	    /* ignore... */
+    }
     interrupted = 1;
 }
 
-- 
1.6.3.3



More information about the notmuch mailing list