]> git.puffer.fish Git - mirror/frr.git/commitdiff
*: fix some solaris warnings
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 28 Aug 2018 08:59:02 +0000 (10:59 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sat, 8 Sep 2018 19:30:42 +0000 (21:30 +0200)
Signed-off-by: David Lamparter <equinox@diac24.net>
bfdd/ptm_adapter.c
lib/if.c
python/clidef.py
tools/start-stop-daemon.c
zebra/if_ioctl_solaris.c
zebra/rtread_getmsg.c

index 4287891621f06306c589b96ebeb9be04708508bb..a5fae3383cd7248ba0994f318e2e877dd90f283f 100644 (file)
@@ -289,7 +289,7 @@ static int _ptm_msg_read(struct stream *msg, int command,
 {
        uint32_t pid;
        uint8_t ttl __attribute__((unused));
-       uint8_t ifnamelen;
+       size_t ifnamelen;
 
        /*
         * Register/Deregister/Update Message format:
index 2bf0c6e6b5ae4a93f65bbaacda9a9864eff9eaa0..a03c9da6f91e5aa6329e662206909d10e758e6aa 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -619,7 +619,7 @@ DEFUN (no_interface_desc,
  *     if not:
  *     - no idea, just get the name in its entirety.
  */
-static struct interface *if_sunwzebra_get(char *name, vrf_id_t vrf_id)
+static struct interface *if_sunwzebra_get(const char *name, vrf_id_t vrf_id)
 {
        struct interface *ifp;
        char *cp;
index 4134f4c94e7239bdd7e887936f4bc6927f5eaff9..a140ce3d5454404312181bb02dee46f542b311b7 100644 (file)
@@ -96,7 +96,7 @@ class IP4Handler(IPBase):
     code = Template('_fail = !inet_aton(argv[_i]->arg, &$varname);')
 class IP6Handler(IPBase):
     argtype = 'struct in6_addr'
-    decl = Template('struct in6_addr $varname = IN6ADDR_ANY_INIT;')
+    decl = Template('struct in6_addr $varname = {};')
     code = Template('_fail = !inet_pton(AF_INET6, argv[_i]->arg, &$varname);')
 class IPGenHandler(IPBase):
     argtype = 'const union sockunion *'
index e1cce85557a3e9528bc929ca63a9fb37446510fc..cc0315c1307de1c0166af7821c752bd56388f8eb 100644 (file)
@@ -607,7 +607,7 @@ static int pid_is_exec(pid_t pid, const struct stat *esb)
        struct stat sb;
        char buf[32];
 
-       sprintf(buf, "/proc/%d/exe", pid);
+       sprintf(buf, "/proc/%ld/exe", (long)pid);
        if (stat(buf, &sb) != 0)
                return 0;
        return (sb.st_dev == esb->st_dev && sb.st_ino == esb->st_ino);
@@ -619,7 +619,7 @@ static int pid_is_user(pid_t pid, uid_t uid)
        struct stat sb;
        char buf[32];
 
-       sprintf(buf, "/proc/%d", pid);
+       sprintf(buf, "/proc/%ld", (long)pid);
        if (stat(buf, &sb) != 0)
                return 0;
        return (sb.st_uid == uid);
@@ -632,7 +632,7 @@ static int pid_is_cmd(pid_t pid, const char *name)
        FILE *f;
        int c;
 
-       sprintf(buf, "/proc/%d/stat", pid);
+       sprintf(buf, "/proc/%ld/stat", (long)pid);
        f = fopen(buf, "r");
        if (!f)
                return 0;
@@ -664,12 +664,12 @@ static void check(pid_t pid)
 static void do_pidfile(const char *name)
 {
        FILE *f;
-       pid_t pid;
+       long pid;
 
        f = fopen(name, "r");
        if (f) {
-               if (fscanf(f, "%d", &pid) == 1)
-                       check(pid);
+               if (fscanf(f, "%ld", &pid) == 1)
+                       check((pid_t)pid);
                fclose(f);
        } else if (errno != ENOENT)
                fatal("open pidfile %s: %s", name, strerror(errno));
@@ -682,7 +682,7 @@ static void do_procinit(void)
        DIR *procdir;
        struct dirent *entry;
        int foundany;
-       pid_t pid;
+       long pid;
 
        procdir = opendir("/proc");
        if (!procdir)
@@ -690,10 +690,10 @@ static void do_procinit(void)
 
        foundany = 0;
        while ((entry = readdir(procdir)) != NULL) {
-               if (sscanf(entry->d_name, "%d", &pid) != 1)
+               if (sscanf(entry->d_name, "%ld", &pid) != 1)
                        continue;
                foundany++;
-               check(pid);
+               check((pid_t)pid);
        }
        closedir(procdir);
        if (!foundany)
@@ -728,21 +728,21 @@ static void do_stop(int signal_nr, int quietmode, int *n_killed,
 
        for (p = found; p; p = p->next) {
                if (testmode)
-                       printf("Would send signal %d to %d.\n", signal_nr,
-                              p->pid);
+                       printf("Would send signal %d to %ld.\n", signal_nr,
+                              (long)p->pid);
                else if (kill(p->pid, signal_nr) == 0) {
                        push(&killed, p->pid);
                        (*n_killed)++;
                } else {
-                       printf("%s: warning: failed to kill %d: %s\n", progname,
-                              p->pid, strerror(errno));
+                       printf("%s: warning: failed to kill %ld: %s\n",
+                              progname, (long)p->pid, strerror(errno));
                        (*n_notkilled)++;
                }
        }
        if (quietmode < 0 && killed) {
                printf("Stopped %s (pid", what_stop);
                for (p = killed; p; p = p->next)
-                       printf(" %d", p->pid);
+                       printf(" %ld", (long)p->pid);
                putchar(')');
                if (retry_nr > 0)
                        printf(", retry #%d", retry_nr);
@@ -1055,7 +1055,7 @@ int main(int argc, char **argv)
                if (pidf == NULL)
                        fatal("Unable to open pidfile `%s' for writing: %s",
                              pidfile, strerror(errno));
-               fprintf(pidf, "%d\n", pidt);
+               fprintf(pidf, "%ld\n", (long)pidt);
                fclose(pidf);
        }
        set_namespaces();
index 5a58fe1751cbc54bbbb131aaf1ccc4007db85284..7ec73ea111cd9b55bbf2d8f7bc0f14d00a3ca28c 100644 (file)
@@ -39,6 +39,7 @@
 #include "zebra/interface.h"
 #include "zebra/ioctl_solaris.h"
 #include "zebra/rib.h"
+#include "zebra/rt.h"
 
 static int if_get_addr(struct interface *, struct sockaddr *, const char *);
 static void interface_info_ioctl(struct interface *);
@@ -55,7 +56,6 @@ static int interface_list_ioctl(int af)
        struct lifconf lifconf;
        struct interface *ifp;
        int n;
-       int save_errno;
        size_t needed, lastneeded = 0;
        char *buf = NULL;
 
@@ -76,13 +76,11 @@ calculate_lifc_len:
                lifn.lifn_flags = LIFC_NOXMIT;
                /* we want NOXMIT interfaces too */
                ret = ioctl(sock, SIOCGLIFNUM, &lifn);
-               save_errno = errno;
-
        }
 
        if (ret < 0) {
                zlog_warn("interface_list_ioctl: SIOCGLIFNUM failed %s",
-                         safe_strerror(save_errno));
+                         safe_strerror(errno));
                close(sock);
                return -1;
        }
index b3aeaf2f76c123e065b98c5d71daec003172acf7..8e5d7fbdbee5d5d6dfc16c669bf0d97f5377e23c 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "zebra/rib.h"
 #include "zebra/rt.h"
+#include "zebra/zebra_pbr.h"
 
 /* Thank you, Solaris, for polluting application symbol namespace. */
 #undef hook_register