ospfd: correct function name in error message

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ospfd: correct function name in error message

Denis Fondras
Fix function name in error message.

Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/kroute.c,v
retrieving revision 1.112
diff -u -p -r1.112 kroute.c
--- kroute.c 28 Dec 2018 19:25:10 -0000 1.112
+++ kroute.c 9 Nov 2019 14:11:03 -0000
@@ -1501,7 +1501,7 @@ rtmsg_process(char *buf, size_t len)
  if ((mpath || prio == kr_state.fib_prio) &&
     (kr = kroute_matchgw(okr, nexthop)) ==
     NULL) {
- log_warnx("dispatch_rtmsg "
+ log_warnx("rtmsg_process "
     "mpath route not found");
  /* add routes we missed out earlier */
  goto add;
@@ -1536,7 +1536,7 @@ rtmsg_process(char *buf, size_t len)
 add:
  if ((kr = calloc(1,
     sizeof(struct kroute_node))) == NULL) {
- log_warn("dispatch calloc");
+ log_warn("rtmsg_process calloc");
  return (-1);
  }
 
@@ -1580,7 +1580,7 @@ add:
  okr = kr;
  if (mpath &&
     (kr = kroute_matchgw(kr, nexthop)) == NULL) {
- log_warnx("dispatch_rtmsg "
+ log_warnx("rtmsg_process "
     "mpath route not found");
  return (-1);
  }

Reply | Threaded
Open this post in threaded view
|

Re: ospfd: correct function name in error message

Claudio Jeker
On Sat, Nov 09, 2019 at 03:27:31PM +0100, Denis Fondras wrote:

> Fix function name in error message.
>
> Index: kroute.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospfd/kroute.c,v
> retrieving revision 1.112
> diff -u -p -r1.112 kroute.c
> --- kroute.c 28 Dec 2018 19:25:10 -0000 1.112
> +++ kroute.c 9 Nov 2019 14:11:03 -0000
> @@ -1501,7 +1501,7 @@ rtmsg_process(char *buf, size_t len)
>   if ((mpath || prio == kr_state.fib_prio) &&
>      (kr = kroute_matchgw(okr, nexthop)) ==
>      NULL) {
> - log_warnx("dispatch_rtmsg "
> + log_warnx("rtmsg_process "
>      "mpath route not found");
>   /* add routes we missed out earlier */
>   goto add;
> @@ -1536,7 +1536,7 @@ rtmsg_process(char *buf, size_t len)
>  add:
>   if ((kr = calloc(1,
>      sizeof(struct kroute_node))) == NULL) {
> - log_warn("dispatch calloc");
> + log_warn("rtmsg_process calloc");
>   return (-1);
>   }
>  
> @@ -1580,7 +1580,7 @@ add:
>   okr = kr;
>   if (mpath &&
>      (kr = kroute_matchgw(kr, nexthop)) == NULL) {
> - log_warnx("dispatch_rtmsg "
> + log_warnx("rtmsg_process "
>      "mpath route not found");
>   return (-1);
>   }
>

OK. Another option is to use __func__ which is always correct.

--
:wq Claudio

Reply | Threaded
Open this post in threaded view
|

Re: ospfd: correct function name in error message

Sebastian Benoit-3
Claudio Jeker([hidden email]) on 2019.11.09 15:32:39 +0100:

> On Sat, Nov 09, 2019 at 03:27:31PM +0100, Denis Fondras wrote:
> > Fix function name in error message.
> >
> > Index: kroute.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ospfd/kroute.c,v
> > retrieving revision 1.112
> > diff -u -p -r1.112 kroute.c
> > --- kroute.c 28 Dec 2018 19:25:10 -0000 1.112
> > +++ kroute.c 9 Nov 2019 14:11:03 -0000
> > @@ -1501,7 +1501,7 @@ rtmsg_process(char *buf, size_t len)
> >   if ((mpath || prio == kr_state.fib_prio) &&
> >      (kr = kroute_matchgw(okr, nexthop)) ==
> >      NULL) {
> > - log_warnx("dispatch_rtmsg "
> > + log_warnx("rtmsg_process "
> >      "mpath route not found");
> >   /* add routes we missed out earlier */
> >   goto add;
> > @@ -1536,7 +1536,7 @@ rtmsg_process(char *buf, size_t len)
> >  add:
> >   if ((kr = calloc(1,
> >      sizeof(struct kroute_node))) == NULL) {
> > - log_warn("dispatch calloc");
> > + log_warn("rtmsg_process calloc");
> >   return (-1);
> >   }
> >  
> > @@ -1580,7 +1580,7 @@ add:
> >   okr = kr;
> >   if (mpath &&
> >      (kr = kroute_matchgw(kr, nexthop)) == NULL) {
> > - log_warnx("dispatch_rtmsg "
> > + log_warnx("rtmsg_process "
> >      "mpath route not found");
> >   return (-1);
> >   }
> >
>
> OK. Another option is to use __func__ which is always correct.

Please definatly use __func__. With that ok benno too.

Reply | Threaded
Open this post in threaded view
|

Re: ospfd: correct function name in error message

Theo de Raadt-2
Sebastian Benoit <[hidden email]> wrote:

> > OK. Another option is to use __func__ which is always correct.
>
> Please definatly use __func__. With that ok benno too.

I like __func__ where it makes sense, but often developers consider
"i've shown an obscurely named function that i know" to be a solved
problem, and then don't show a good explanation that a user can deal
with.

So always step back and think:  Let's say the person doesn't have the
source tree or the ability to read.  Can they determine their next
step?

Often times __func__ is not an improvement, because it can be used
like a crutch.