]> git.ipfire.org Git - people/ms/rstp.git/commitdiff
fixes for 4.3.3 GCC warnings/errors
authorDenys Fedoryschenko <denys@visp.net.lb>
Wed, 1 Apr 2009 16:06:55 +0000 (09:06 -0700)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Wed, 1 Apr 2009 16:06:55 +0000 (09:06 -0700)
After fetching current git code and compiling with gcc 4.3.3 got errors
related to Werror (2 functions was ignoring return value), and ulimits.h was
not declared, but INT_MAX used
Here is fix, so rstp compile fine with gcc 4.3.3

Signed-off-by: Denys Fedoryschenko <denys@visp.net.lb>
bridge_track.c
ctl_main.c
main.c
netif_utils.c

index da53d9bd8b75127ef466419f91335a01e2a13dff..be555decf79cc8055d22e22c6abf77457e715f38 100644 (file)
@@ -386,6 +386,7 @@ void delete_if(struct ifdata *ifc)
 static int stp_enabled(struct ifdata *br)
 {
        char path[40 + IFNAMSIZ];
+       int ret;
        sprintf(path, "/sys/class/net/%s/bridge/stp_state", br->name);
        FILE *f = fopen(path, "r");
        if (!f) {
@@ -393,7 +394,11 @@ static int stp_enabled(struct ifdata *br)
                return 0;
        }
        int enabled = 0;
-       fscanf(f, "%d", &enabled);
+       ret = fscanf(f, "%d", &enabled);
+       if (!ret) {
+               LOG("%s, stp_state parsing error", path);
+               return 0;
+       }
        fclose(f);
        INFO("STP on %s state %d", br->name, enabled);
 
index 8eaa76d13912183163be25385dcc6ae1ba2dae6f..83dee9fb165f3a28182655b886e5ef07c138111e 100644 (file)
@@ -16,6 +16,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <limits.h>
 
 #include "ctl_socket_client.h"
 #include "ctl_functions.h"
diff --git a/main.c b/main.c
index 2c782859669618596fc9cfdd2358643344fd07f1..a8c21aca05e43828de4790b2eb5e1d8a6c28cca5 100644 (file)
--- a/main.c
+++ b/main.c
@@ -42,7 +42,7 @@ int log_level = LOG_LEVEL_DEFAULT;
 
 int main(int argc, char *argv[])
 {
-       int c;
+       int c,ret;
        while ((c = getopt(argc, argv, "dv:")) != -1) {
                switch (c) {
                case 'd':
@@ -78,7 +78,11 @@ int main(int argc, char *argv[])
                        return -1;
                }
                openlog("rstpd", 0, LOG_DAEMON);
-               daemon(0, 0);
+               ret = daemon(0, 0);
+               if (ret) {
+                       ERROR("daemon() failed");
+                       return -1;                  
+               }
                is_daemon = 1;
                fprintf(f, "%d", getpid());
                fclose(f);
index eeb12ff06b1cdd390613b4da19885a38b9d89743..719581c7ad5c22027a15c3c1d1e10c8b7e6e1bb9 100644 (file)
@@ -32,6 +32,7 @@
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
+#include <limits.h>
 
 #include <net/if.h>
 #include <linux/if_ether.h>