Reviewed-by: Jacob Keller <jacob.e.kel...@intel.com>
On 5/16/2020 8:03 AM, Richard Cochran wrote: > The port_forward_to() method clobbers the specific error code returned > by the transport layer with -1. This patch lets the code preserve the > specific error in question. > > Signed-off-by: Richard Cochran <richardcoch...@gmail.com> > --- > port.c | 6 ++++-- > port.h | 2 +- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/port.c b/port.c > index 6104061..48fff1c 100644 > --- a/port.c > +++ b/port.c > @@ -2737,8 +2737,10 @@ int port_forward_to(struct port *p, struct ptp_message > *msg) > { > int cnt; > cnt = transport_sendto(p->trp, &p->fda, TRANS_GENERAL, msg); > - if (cnt <= 0) { > - return -1; > + if (cnt < 0) { > + return cnt; > + } else if (!cnt) { > + return -EIO; > } > port_stats_inc_tx(p, msg); > return 0; > diff --git a/port.h b/port.h > index a45a7a4..e347e36 100644 > --- a/port.h > +++ b/port.h > @@ -94,7 +94,7 @@ int port_forward(struct port *p, struct ptp_message *msg); > * Forward a message on a given port to the address stored in the message. > * @param port A pointer previously obtained via port_open(). > * @param msg The message to send. Must be in network byte order. > - * @return Zero on success, non-zero otherwise. > + * @return Zero on success, negative errno value otherwise. > */ > int port_forward_to(struct port *p, struct ptp_message *msg); > > _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel