]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Quagga: Fix compile warnings for GCC4.9
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 24 Sep 2015 23:57:36 +0000 (16:57 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 25 Sep 2015 17:11:24 +0000 (10:11 -0700)
As part of the debian build process for jessie we are seeing
some compile issues.  This addresses these issues

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_debug.c
bgpd/bgp_route.c
bgpd/bgp_updgrp.h
bgpd/bgpd.c
lib/vty.c
zebra/router-id.c

index 48b4ba30d96e24135ebd2bcabd473ae9e5132218..3829a7d121ba77907178a55e70d7c3ccca6b7df5 100644 (file)
@@ -1081,7 +1081,7 @@ DEFUN (debug_bgp_update_direct_peer,
     {
       struct peer *peer;
       struct peer_af *paf;
-      int af;
+      enum bgp_af_index af;
 
       bgp_debug_list_add_entry(bgp_debug_update_out_peers, host, NULL);
       peer = bgp_find_peer (vty, host);
@@ -1220,7 +1220,7 @@ DEFUN (no_debug_bgp_update_direct_peer,
 
       struct peer *peer;
       struct peer_af *paf;
-      int af;
+      enum bgp_af_index af;
       peer = bgp_find_peer (vty, host);
 
       if (peer)
index efcaf231507edd8685e96293253c6a4a2abb5903..d27603410e96f899cfd704f0e506121768179f1d 100644 (file)
@@ -2200,7 +2200,7 @@ bgp_process_queue_init (void)
   bm->process_main_queue->spec.yield = 50 * 1000L;
   
   memcpy (bm->process_rsclient_queue, bm->process_main_queue,
-          sizeof (struct work_queue *));
+          sizeof (struct work_queue));
   bm->process_rsclient_queue->spec.workfunc = &bgp_process_rsclient;
 }
 
index ae72214631df21e3b7db81f6b642f3c8dc661fdb..bf48e12a5dc33d9e55d58c53a9ed8351191bbade 100644 (file)
@@ -517,7 +517,7 @@ static inline void
 update_group_adjust_peer_afs (struct peer *peer)
 {
   struct peer_af *paf;
-  afi_t afi;
+  enum bgp_af_index afi;
 
   PEERAF_FOREACH (peer, paf, afi) update_group_adjust_peer (paf);
 }
@@ -531,7 +531,7 @@ static inline void
 update_group_remove_peer_afs (struct peer *peer)
 {
   struct peer_af *paf;
-  afi_t afi;
+  enum bgp_af_index afi;
 
   PEERAF_FOREACH (peer, paf, afi)
     update_subgroup_remove_peer (PAF_SUBGRP (paf), paf);
@@ -581,7 +581,7 @@ static inline void
 bgp_announce_peer (struct peer *peer)
 {
   struct peer_af *paf;
-  int af;
+  enum bgp_af_index af;
 
   PEERAF_FOREACH (peer, paf, af) subgroup_announce_all (PAF_SUBGRP (paf));
 }
index 26f778909e7b37a18397cad5a83270be20906faf..e43fb5a5dbb81555068297e1b726ef79b44ce5a9 100644 (file)
@@ -1091,7 +1091,7 @@ peer_xfer_config (struct peer *peer_dst, struct peer *peer_src)
   struct peer_af *paf;
   afi_t afi;
   safi_t safi;
-  int afindex;
+  enum bgp_af_index afindex;
 
   assert(peer_src);
   assert(peer_dst);
index e617d1f65a10430dff0a450f45d65bb44c04daab..d7607881b21f84e7b1261b07b6e468b3639847ff 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2311,8 +2311,16 @@ vty_use_backup_config (char *fullpath)
     }
   
   while((c = read (sav, buffer, 512)) > 0)
-    write (tmp, buffer, c);
-  
+    {
+      if (write (tmp, buffer, c) <= 0)
+       {
+         free (fullpath_sav);
+         free (fullpath_tmp);
+         close (sav);
+         close (tmp);
+         return NULL;
+       }
+    }
   close (sav);
   close (tmp);
   
@@ -2349,7 +2357,11 @@ vty_read_config (char *config_file,
     {
       if (! IS_DIRECTORY_SEP (config_file[0]))
         {
-          getcwd (cwd, MAXPATHLEN);
+          if (getcwd (cwd, MAXPATHLEN) == NULL)
+           {
+             fprintf (stderr, "Failure to determine Current Working Directory %d!\n", errno);
+             exit (1);
+           }
           tmp = XMALLOC (MTYPE_TMP, 
                              strlen (cwd) + strlen (config_file) + 2);
           sprintf (tmp, "%s/%s", cwd, config_file);
@@ -2484,7 +2496,11 @@ vty_log_fixed (char *buf, size_t len)
       if (((vty = vector_slot (vtyvec, i)) != NULL) && vty->monitor)
        /* N.B. We don't care about the return code, since process is
           most likely just about to die anyway. */
-       writev(vty->fd, iov, 2);
+       if (writev(vty->fd, iov, 2) == -1)
+         {
+           fprintf(stderr, "Failure to writev: %d\n", errno);
+           exit(-1);
+         }
     }
 }
 
@@ -2932,8 +2948,21 @@ vty_save_cwd (void)
 
   if (!c)
     {
-      chdir (SYSCONFDIR);
-      getcwd (cwd, MAXPATHLEN);
+      /*
+       * At this point if these go wrong, more than likely
+       * the whole world is coming down around us
+       * Hence not worrying about it too much.
+       */
+      if (!chdir (SYSCONFDIR))
+       {
+         fprintf(stderr, "Failure to chdir to %s, errno: %d\n", SYSCONFDIR, errno);
+         exit(-1);
+       }
+      if (getcwd (cwd, MAXPATHLEN) == NULL)
+       {
+         fprintf(stderr, "Failure to getcwd, errno: %d\n", errno);
+         exit(-1);
+       }
     }
 
   vty_cwd = XMALLOC (MTYPE_TMP, strlen (cwd) + 1);
index ae52b5ea6c538f49315a4b5b8bc3a9a50cb701eb..a17cd9e57fd60695cc23e219ba7d787889897e1a 100644 (file)
@@ -242,8 +242,8 @@ router_id_init (void)
   install_element (CONFIG_NODE, &router_id_cmd);
   install_element (CONFIG_NODE, &no_router_id_cmd);
 
-  memset (rid_all_sorted_list, 0, sizeof (rid_all_sorted_list));
-  memset (rid_lo_sorted_list, 0, sizeof (rid_lo_sorted_list));
+  memset (rid_all_sorted_list, 0, sizeof (_rid_all_sorted_list));
+  memset (rid_lo_sorted_list, 0, sizeof (_rid_lo_sorted_list));
   memset (&rid_user_assigned, 0, sizeof (rid_user_assigned));
 
   rid_all_sorted_list->cmp = router_id_cmp;