Enable strict standards conformance and fix resulting errors
authorMikko Rasa <tdb@tdb.fi>
Sun, 16 Nov 2014 16:12:50 +0000 (18:12 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 16 Nov 2014 16:12:50 +0000 (18:12 +0200)
Makefile
main.c

index dd03d7ca5645b205224109a44fa38f57150d92bf..1632770d0e08e7a6358236989f962422d6ff1d5c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,2 @@
 pmount-gui: main.c
-       $(CC) -Wall -Wextra -o $@ $^ $(shell pkg-config --cflags --libs gtk+-2.0)
+       $(CC) -Wall -Wextra -std=c90 -pedantic -o $@ $^ $(shell pkg-config --cflags --libs gtk+-2.0)
diff --git a/main.c b/main.c
index 916c2e214fce6c636c6eaf5889a012231af990eb..63921300b2bf373105ae557e773295b0d74489c4 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,3 +1,5 @@
+/* Required for strdup, snprintf, getopt */
+#define _XOPEN_SOURCE 500
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -7,6 +9,7 @@
 #include <mntent.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
+#include <sys/select.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
@@ -427,10 +430,12 @@ Device *get_devices(void)
 
        for(i=0; nodes[i]; ++i)
        {
+               Property *props;
+
                if(verbosity>=1)
                        printf("Examining device %s\n", nodes[i]);
 
-               Property *props = get_device_properties(nodes[i]);
+               props = get_device_properties(nodes[i]);
                if(!props)
                {
                        if(verbosity>=2)