]> git.ipfire.org Git - people/ms/rstp.git/commitdiff
netlink shouldn't kill daemon
authorStephen Hemminger <shemminger@linux-foundation.org>
Thu, 22 Mar 2007 20:41:40 +0000 (13:41 -0700)
committerStephen Hemminger <shemminger@linux-foundation.org>
Thu, 22 Mar 2007 20:41:40 +0000 (13:41 -0700)
A netlink error shouldn't cause silent death of daemon.
It doesn't work well if library calls exit().

libnetlink.c

index 089b99a3e14cb82b28dd808f923da1506bd3f8f3..2fb76b2347f19042a39b8ff17e246b68261ca255 100644 (file)
@@ -227,7 +227,7 @@ int rtnl_dump_filter(struct rtnl_handle *rth,
                }
                if (status) {
                        fprintf(stderr, "!!!Remnant of size %d\n", status);
-                       exit(1);
+                       return -1;
                }
        }
 }
@@ -290,7 +290,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
                if (msg.msg_namelen != sizeof(nladdr)) {
                        fprintf(stderr, "sender address length == %d\n",
                                msg.msg_namelen);
-                       exit(1);
+                       return -1;
                }
                for (h = (struct nlmsghdr *)buf; status >= sizeof(*h);) {
                        int err;
@@ -304,7 +304,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
                                }
                                fprintf(stderr,
                                        "!!!malformed message: len=%d\n", len);
-                               exit(1);
+                               return -1;
                        }
 
                        if (nladdr.nl_pid != peer ||
@@ -355,7 +355,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
                }
                if (status) {
                        fprintf(stderr, "!!!Remnant of size %d\n", status);
-                       exit(1);
+                       return -1;
                }
        }
 }
@@ -399,7 +399,7 @@ int rtnl_listen(struct rtnl_handle *rtnl, rtnl_filter_t handler, void *jarg)
                if (msg.msg_namelen != sizeof(nladdr)) {
                        fprintf(stderr, "Sender address length == %d\n",
                                msg.msg_namelen);
-                       exit(1);
+                       return -1;
                }
                for (h = (struct nlmsghdr *)buf; status >= sizeof(*h);) {
                        int err;
@@ -413,7 +413,7 @@ int rtnl_listen(struct rtnl_handle *rtnl, rtnl_filter_t handler, void *jarg)
                                }
                                fprintf(stderr,
                                        "!!!malformed message: len=%d\n", len);
-                               exit(1);
+                               return -1;
                        }
 
                        err = handler(&nladdr, h, jarg);
@@ -431,7 +431,7 @@ int rtnl_listen(struct rtnl_handle *rtnl, rtnl_filter_t handler, void *jarg)
                }
                if (status) {
                        fprintf(stderr, "!!!Remnant of size %d\n", status);
-                       exit(1);
+                       return -1;
                }
        }
 }