Message ID | 20151110041902.GC8509@ovn.org |
---|---|
State | Not Applicable |
Headers | show |
hi, On Tue, Nov 10, 2015 at 1:19 PM, Ben Pfaff <blp@ovn.org> wrote: > On Mon, Oct 19, 2015 at 01:29:01PM +0900, YAMAMOTO Takashi wrote: >> On NetBSD, strerror(0) is "Undefined error: 0". >> >> Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com> >> --- >> tests/ofproto-macros.at | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at >> index 94d7c86..368dade 100644 >> --- a/tests/ofproto-macros.at >> +++ b/tests/ofproto-macros.at >> @@ -28,7 +28,8 @@ prt==1 { sub(/[ \t]*$/, ""); print $0 } >> vconn_sub() { >> sed ' >> s/tcp:127.0.0.1:[0-9][0-9]*:/unix:/ >> -s/No error/Success/ >> +s/(No error)/(Success)/ >> +s/(Undefined error: 0)/(Success)/ >> ' >> } > > Since we now have two different OSes that need special treatment here, > it might be better to do something more uniform to avoid the special > treatment. One idea would be to modify ovs_strerror() to always provide > the same string for error 0. Another would be to modify vconn.c to > avoid indicating any error when there is none, e.g.: it's a good idea. > > diff --git a/lib/vconn.c b/lib/vconn.c > index d835943..f50f3e8 100644 > --- a/lib/vconn.c > +++ b/lib/vconn.c > @@ -683,7 +683,9 @@ do_send(struct vconn *vconn, struct ofpbuf *msg) > } else { > char *s = ofp_to_string(msg->data, msg->size, 1); > retval = (vconn->vclass->send)(vconn, msg); > - if (retval != EAGAIN) { > + if (!retval) { > + VLOG_DBG_RL(&ofmsg_rl, "%s: sent: %s", vconn->name, s); > + } else if (retval != EAGAIN) { > VLOG_DBG_RL(&ofmsg_rl, "%s: sent (%s): %s", > vconn->name, ovs_strerror(retval), s); > } >
diff --git a/lib/vconn.c b/lib/vconn.c index d835943..f50f3e8 100644 --- a/lib/vconn.c +++ b/lib/vconn.c @@ -683,7 +683,9 @@ do_send(struct vconn *vconn, struct ofpbuf *msg) } else { char *s = ofp_to_string(msg->data, msg->size, 1); retval = (vconn->vclass->send)(vconn, msg); - if (retval != EAGAIN) { + if (!retval) { + VLOG_DBG_RL(&ofmsg_rl, "%s: sent: %s", vconn->name, s); + } else if (retval != EAGAIN) { VLOG_DBG_RL(&ofmsg_rl, "%s: sent (%s): %s", vconn->name, ovs_strerror(retval), s); }