port: Convey targeted forwarding errors to the caller.
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 <richardcochran@gmail.com>master
parent
a6e0b83bd5
commit
5aa19dd3f4
6
port.c
6
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;
|
||||
|
|
2
port.h
2
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue