summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_notification.c
diff options
context:
space:
mode:
authorroot <root@hestia.halldom.com>2010-07-22 00:55:23 +0100
committerroot <root@hestia.halldom.com>2010-07-22 00:55:23 +0100
commit0f1365093f448e9503b618a5097eb8d6433e7710 (patch)
tree5db698d8d51a441aacd0f5d8ed6e83458bee294c /bgpd/bgp_notification.c
parent378deb2ebf5b34c053f212e14aa0c9d62c4bc85d (diff)
downloadquagga-0f1365093f448e9503b618a5097eb8d6433e7710.tar.bz2
quagga-0f1365093f448e9503b618a5097eb8d6433e7710.tar.xz
Trap SIGABRT so that get backtrace in the log.
Improve handling of notification objects, and the printing of same to the logs.
Diffstat (limited to 'bgpd/bgp_notification.c')
-rw-r--r--bgpd/bgp_notification.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/bgpd/bgp_notification.c b/bgpd/bgp_notification.c
index 45bf99b7..c0690df9 100644
--- a/bgpd/bgp_notification.c
+++ b/bgpd/bgp_notification.c
@@ -203,19 +203,25 @@ bgp_notify_take(bgp_notify* p_notification)
extern void
bgp_notify_set(bgp_notify* p_dst, bgp_notify src)
{
- bgp_notify_free(*p_dst) ;
- *p_dst = src ;
+ if (*p_dst != src) /* empty operation if already set ! */
+ {
+ bgp_notify_free(*p_dst) ;
+ *p_dst = src ;
+ } ;
} ;
/*------------------------------------------------------------------------------
* Set pointer to notification to a *copy* of the source.
*
- * Frees any existing notification at the destination.
+ * Frees any existing notification at the destination unless points at src !
*/
extern void
bgp_notify_set_dup(bgp_notify* p_dst, bgp_notify src)
{
- bgp_notify_set(p_dst, bgp_notify_dup(src)) ;
+ if (*p_dst != src)
+ bgp_notify_free(*p_dst) ; /* avoid freeing what we're duplicating */
+
+ *p_dst = bgp_notify_dup(src) ;
} ;
/*------------------------------------------------------------------------------
@@ -228,8 +234,7 @@ bgp_notify_set_dup(bgp_notify* p_dst, bgp_notify src)
extern void
bgp_notify_set_mov(bgp_notify* p_dst, bgp_notify* p_src)
{
- bgp_notify_free(*p_dst) ;
- *p_dst = *p_src ;
+ bgp_notify_set(p_dst, *p_src) ;
*p_src = NULL ;
} ;