From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 02/41] libcman: fix fd usage
Date: Wed, 23 Nov 2011 10:32:03 +0000 [thread overview]
Message-ID: <1322044323.2797.5.camel@menhir> (raw)
In-Reply-To: <9be9dec9e1423f045eaab137f237f0360bccc842.1322043045.git.fdinitto@redhat.com>
Hi,
On Wed, 2011-11-23 at 11:15 +0100, Fabio M. Di Nitto wrote:
> Spotted by Coverity Scan
>
> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
> ---
> :100644 100644 9ea82c1... 46f5c89... M cman/lib/libcman.c
> cman/lib/libcman.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
> index 9ea82c1..46f5c89 100644
> --- a/cman/lib/libcman.c
> +++ b/cman/lib/libcman.c
> @@ -318,8 +318,8 @@ static cman_handle_t open_socket(const char *name, int namelen, void *privdata)
> free(h);
> h = NULL;
> errno = saved_errno;
> - }
> - fcntl(h->zero_fd, F_SETFD, 1); /* Set close-on-exec */
> + } else
> + fcntl(h->zero_fd, F_SETFD, 1); /* Set close-on-exec */
FD_CLOEXEC would be a bit clearer than 1, even with the comment. Also
its normal to do a F_GETFD first and OR the new flag so that you don't
accidentally reset any other flags that are set on the fd beforehand.
I'm not sure whether that makes sense in this particular case though,
Steve.
>
> return (cman_handle_t)h;
> }
next prev parent reply other threads:[~2011-11-23 10:32 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 10:15 [Cluster-devel] [coverity] cman Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 01/41] libcman: fix bad flags check Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 02/41] libcman: fix fd usage Fabio M. Di Nitto
2011-11-23 10:32 ` Steven Whitehouse [this message]
2011-11-23 10:46 ` Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 03/41] libcman: fix variable type Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 04/41] libcman: fix possible memory leak Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 05/41] libcman: correctly check for vars before using them Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 06/41] libcman: switch to strncpy to avoid possible buffer overflows Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 07/41] cman_tool: make cman_error static and make it use it's arg instead of global errno Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 08/41] cman_tool: don't use envp from main Fabio M. Di Nitto
2011-11-23 10:28 ` Steven Whitehouse
2011-11-23 10:45 ` Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 09/41] cman_tool: prevent buffer overrun Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 10/41] cman_tool: check that memory is allocated Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 11/41] cman_tool: drop unused vars and fix value check Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 12/41] cman: add check to guarantee we found our own node name Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 13/41] cman: drop dead code and fix code logic Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 14/41] cman_tool: fix a few possible buffer overflow Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 15/41] cman: fix a few var checks and types Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 16/41] cman: drop unrequired/unused vars and functions Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 17/41] cman: make 2 var const and allow backup defaults Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 18/41] cman: move check of null at beginning Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 19/41] cman: init structs before use Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 20/41] cman: simplify code Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 21/41] cman: fix free handle logic Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 22/41] cman: fix several virtually impossible buffer overflows Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 23/41] notifyd: check for pid errors and report them Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 24/41] notifyd: fix virtually impossible buffer overflows Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 25/41] qdiskd: use correct sizeof for memb_mask_t Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 26/41] qdiskd: report errors on cman_dispatch failures Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 27/41] qdiskd: check for sscanf return codes Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 28/41] qdisk: fix scandisk eval check Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 29/41] qdiskd: add strlen check to avoid memory corruption Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 30/41] qdiskd: warn users when we cannot write eviction notice to disk Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 31/41] qdiskd: don�t deference null variable Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 32/41] qdiskd: clean code around case Fabio M. Di Nitto
2011-11-29 17:59 ` Lon Hohberger
2011-11-29 18:24 ` Fabio M. Di Nitto
2011-11-30 21:23 ` Lon Hohberger
2011-11-23 10:15 ` [Cluster-devel] [PATCH 33/41] qdiskd: don't try the impossible if we can't open /dev/null Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 34/41] qdiskd: avoid a potential crash in case config state is invalid Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 35/41] qdiskd: change variable type Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 36/41] qdiskd: implement better string handling Fabio M. Di Nitto
2011-11-29 18:01 ` Lon Hohberger
2011-11-23 10:15 ` [Cluster-devel] [PATCH 37/41] qdiskd: add failure paths to check_process_running and drop duplicate check Fabio M. Di Nitto
2011-11-29 18:03 ` Lon Hohberger
2011-11-23 10:15 ` [Cluster-devel] [PATCH 38/41] qdiskd: fix possible resource leak in scandisk Fabio M. Di Nitto
2011-11-29 18:04 ` Lon Hohberger
2011-11-23 10:15 ` [Cluster-devel] [PATCH 39/41] qdiskd: don't leak memory if we fail to read from disk Fabio M. Di Nitto
2011-11-23 10:15 ` [Cluster-devel] [PATCH 40/41] qdiskd: fix uninitialized values Fabio M. Di Nitto
2011-11-23 10:16 ` [Cluster-devel] [PATCH 41/41] qdiskd: fix more uninizialized values Fabio M. Di Nitto
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=1322044323.2797.5.camel@menhir \
--to=swhiteho@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).