From 14742ef566e8aa22a3243652418d1faa1036d369 Mon Sep 17 00:00:00 2001 From: Jiri Benc Date: Fri, 2 May 2014 12:37:44 +0200 Subject: [PATCH] uds: don't output "Connection refused" When phc2sys is started before ptp4l or it is interrupted before ptp4l has a chance to reply to its query, the "uds: sendto failed: Connection refused" message is output. This is not an interesting message. Also, don't output the "failed to send message" error from pmc_send, as all transports output errors in their send routine. Signed-off-by: Jiri Benc --- pmc_common.c | 10 +++------- uds.c | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pmc_common.c b/pmc_common.c index a7201f9..2c75074 100644 --- a/pmc_common.c +++ b/pmc_common.c @@ -143,18 +143,14 @@ static struct ptp_message *pmc_message(struct pmc *pmc, uint8_t action) static int pmc_send(struct pmc *pmc, struct ptp_message *msg, int pdulen) { - int cnt, err; + int err; + err = msg_pre_send(msg); if (err) { pr_err("msg_pre_send failed"); return -1; } - cnt = transport_send(pmc->transport, &pmc->fdarray, 0, msg); - if (cnt < 0) { - pr_err("failed to send message"); - return -1; - } - return 0; + return transport_send(pmc->transport, &pmc->fdarray, 0, msg); } static int pmc_tlv_datalen(struct pmc *pmc, int id) diff --git a/uds.c b/uds.c index e88b333..e98e32c 100644 --- a/uds.c +++ b/uds.c @@ -111,7 +111,7 @@ static int uds_send(struct transport *t, struct fdarray *fda, int event, addr = &uds->address; cnt = sendto(fd, buf, buflen, 0, &addr->sa, addr->len); - if (cnt <= 0) { + if (cnt <= 0 && errno != ECONNREFUSED) { pr_err("uds: sendto failed: %m"); } return cnt;