From: Dave Jones <davej@redhat.com>
To: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: trinity@vger.kernel.org
Subject: Re: [PATCH 2/6] trinity.c: log errors if socket calls fail
Date: Fri, 5 Jul 2013 10:46:08 -0400 [thread overview]
Message-ID: <20130705144608.GB31027@redhat.com> (raw)
In-Reply-To: <1372967744-29353-3-git-send-email-mikko.rapeli@iki.fi>
On Thu, Jul 04, 2013 at 10:55:40PM +0300, Mikko Rapeli wrote:
> Maybe that's all that needs to be done at this point.
>
> Coverity CID 1042335 (#1 of 1): Unchecked return value from library
> (CHECKED_RETURN)
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> ---
> trinity.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/trinity.c b/trinity.c
> index 3f80020..de61dcb 100644
> --- a/trinity.c
> +++ b/trinity.c
> @@ -249,12 +249,17 @@ int main(int argc, char* argv[])
> cleanup_fds:
>
> for (i = 0; i < nr_sockets; i++) {
> + int r = 0;
> struct linger ling;
> memset(&ling, 0, sizeof(ling));
>
> ling.l_onoff = FALSE; /* linger active */
> - setsockopt(shm->socket_fds[i], SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger));
> - shutdown(shm->socket_fds[i], SHUT_RDWR);
> + r = setsockopt(shm->socket_fds[i], SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger));
> + if (r)
> + perror("setsockopt");
> + r = shutdown(shm->socket_fds[i], SHUT_RDWR);
> + if (r)
> + perror("shutdown");
> close(shm->socket_fds[i]);
> }
Resubmit this one after redoing that linger diff too, as it'll need rebasing.
thanks,
Dave
next prev parent reply other threads:[~2013-07-05 14:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-04 19:55 [PATCH 0/6] Some simple Coverity fixes Mikko Rapeli
2013-07-04 19:55 ` [PATCH 1/6] trinity.c: fix uninitialized variable Mikko Rapeli
2013-07-05 14:44 ` Dave Jones
2013-07-05 16:15 ` [PATCHv2 1/2] " Mikko Rapeli
2013-07-05 16:15 ` [PATCHv2 2/2] trinity.c: log errors if socket calls fail Mikko Rapeli
2013-07-04 19:55 ` [PATCH 2/6] " Mikko Rapeli
2013-07-05 14:46 ` Dave Jones [this message]
2013-07-04 19:55 ` [PATCH 3/6] perf_event_open: initialize chars Mikko Rapeli
2013-07-04 19:55 ` [PATCH 4/6] perf_event_open.c: close dir's on exit paths Mikko Rapeli
2013-07-04 19:55 ` [PATCH 5/6] sockets.c: don't leak cachefile on return paths Mikko Rapeli
2013-07-04 19:55 ` [PATCH 6/6] maps.c: only close() if fd is valid Mikko Rapeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130705144608.GB31027@redhat.com \
--to=davej@redhat.com \
--cc=mikko.rapeli@iki.fi \
--cc=trinity@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.