From 5d4ab2e6266cce32fc39f228bb8f059596c06482 Mon Sep 17 00:00:00 2001
From: Dave Davenport <qball@gmpclient.org>
Date: Sun, 1 Feb 2015 15:12:29 +0100
Subject: [PATCH] Always compile with Extra warnings.

---
 Makefile.am   |  1 +
 configure.ac  |  1 +
 source/rofi.c | 10 +++++-----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 55dd561c..a55dd526 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,6 +11,7 @@ LIBS=\
 	@pango_LIBS@
 
 AM_CFLAGS=\
+	@EXTRA_CFLAGS@\
     @xft_CFLAGS@\
     @x11_CFLAGS@\
     @xinerama_CFLAGS@\
diff --git a/configure.ac b/configure.ac
index 6ca4e75a..9c87ce22 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,6 +52,7 @@ PKG_CHECK_MODULES([x11], [x11])
 PKG_CHECK_MODULES([xinerama], [xinerama])
 PKG_CHECK_MODULES([pango], [pango pangoxft])
 
+AC_SUBST([EXTRA_CFLAGS], ["-Wall -Wextra"])
 
 AC_CONFIG_FILES([Makefile ])
 AC_OUTPUT
diff --git a/source/rofi.c b/source/rofi.c
index c71eab60..d2a169a6 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -2750,7 +2750,10 @@ static void create_pid_file ( const char *pidfile )
         // Write pid, not needed, but for completeness sake.
         char buffer[64];
         int length = snprintf ( buffer, 64, "%i", getpid () );
-        ssize_t l  = write ( fd, buffer, length );
+        ssize_t l  = 0;
+        while ( l < length ) {
+            l += write ( fd, &buffer[l], length - l );
+        }
     }
 }
 
@@ -2918,10 +2921,7 @@ int main ( int argc, char *argv[] )
 
         // Setup handler for sighub (reload config)
         const struct sigaction hup_action = {
-            .sa_handler  = hup_action_handler,
-            .sa_mask     =                  0,
-            .sa_flags    =                  0,
-            .sa_restorer = NULL
+            .sa_handler = hup_action_handler
         };
         sigaction ( SIGHUP, &hup_action, NULL );