From: Donald Sharp Date: Thu, 24 Sep 2015 23:57:36 +0000 (-0700) Subject: Quagga: Fix compile warnings for GCC4.9 X-Git-Tag: frr-2.0-rc1~1245 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=77f2455171aa150176750cc02a25cad984a30bb7;p=matthieu%2Ffrr.git Quagga: Fix compile warnings for GCC4.9 As part of the debian build process for jessie we are seeing some compile issues. This addresses these issues Signed-off-by: Donald Sharp --- diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 48b4ba30d9..3829a7d121 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -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) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index efcaf23150..d27603410e 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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; } diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h index ae72214631..bf48e12a5d 100644 --- a/bgpd/bgp_updgrp.h +++ b/bgpd/bgp_updgrp.h @@ -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)); } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 26f778909e..e43fb5a5db 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -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); diff --git a/lib/vty.c b/lib/vty.c index e617d1f65a..d7607881b2 100644 --- 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); diff --git a/zebra/router-id.c b/zebra/router-id.c index ae52b5ea6c..a17cd9e57f 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -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;