Hi Mahesh, It is an alternative, but as of today in OpenSAF only MSG_NOSIGNAL is used, I think it is better to follow that pattern. /Thanks HansN
-----Original Message----- From: A V Mahesh [mailto:[email protected]] Sent: den 25 november 2016 06:49 To: Hans Nordebäck <[email protected]> Cc: [email protected] Subject: Re: [PATCH 1 of 1] mds: avoid SIGPIPE in mds_register_callback() [#2203] Hi HansN, ACK with following Do you agree the better alternativeis that to do setsockopt(fd, ...... SO_NOSIGPIPE, instead of each send ? -AVM On 11/23/2016 3:29 PM, Hans Nordeback wrote: > osaf/libs/core/mds/mds_main.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > > diff --git a/osaf/libs/core/mds/mds_main.c > b/osaf/libs/core/mds/mds_main.c > --- a/osaf/libs/core/mds/mds_main.c > +++ b/osaf/libs/core/mds/mds_main.c > @@ -181,7 +181,7 @@ static void mds_register_callback(int fd > uint32_t sz = ncs_encode_32bit(&p, MDS_REGISTER_RESP); > sz += ncs_encode_32bit(&p, 0); // result OK > > - if ((n = send(fd, buf, sz, 0)) == -1) > + if ((n = send(fd, buf, sz, MSG_NOSIGNAL)) == -1) > syslog(LOG_ERR, "MDS: %s: send to pid %d failed - %s", > __FUNCTION__, creds->pid, > strerror(errno)); > } else if (type == MDS_UNREGISTER_REQ) { @@ -198,7 +198,7 @@ static > void mds_register_callback(int fd > uint32_t sz = ncs_encode_32bit(&p, MDS_UNREGISTER_RESP); > sz += ncs_encode_32bit(&p, 0); // result OK > > - if ((n = send(fd, buf, sz, 0)) == -1) > + if ((n = send(fd, buf, sz, MSG_NOSIGNAL)) == -1) > syslog(LOG_ERR, "MDS: %s: send to pid %d failed - %s", > __FUNCTION__, creds->pid, > strerror(errno)); > } else { ------------------------------------------------------------------------------ _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
