cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 08/41] cman_tool: don't use envp from main
Date: Wed, 23 Nov 2011 10:28:40 +0000	[thread overview]
Message-ID: <1322044120.2797.2.camel@menhir> (raw)
In-Reply-To: <c6f2e4ff28c23c0886419d105c72f1db4b957b81.1322043045.git.fdinitto@redhat.com>

Hi,

On Wed, 2011-11-23 at 11:15 +0100, Fabio M. Di Nitto wrote:
> according to wikipedia it is a microsoft extensions. Use __environ
> directly from unistd.h
> 
> Spotted by Coverity Scan
> 
> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
> ---
> :100644 100644 60091c9... 6c5744e... M	cman/cman_tool/cman_tool.h
> :100644 100644 872528b... b92090c... M	cman/cman_tool/join.c
> :100644 100644 a336c42... 6d8a1eb... M	cman/cman_tool/main.c
>  cman/cman_tool/cman_tool.h |    3 +--
>  cman/cman_tool/join.c      |   13 +++++++------
>  cman/cman_tool/main.c      |   10 +++++-----
>  3 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/cman/cman_tool/cman_tool.h b/cman/cman_tool/cman_tool.h
> index 60091c9..6c5744e 100644
> --- a/cman/cman_tool/cman_tool.h
> +++ b/cman/cman_tool/cman_tool.h
> @@ -19,7 +19,6 @@
>  #include <fcntl.h>
>  #include <netdb.h>
>  #include <limits.h>
> -#include <unistd.h>
>  
>  extern char *prog_name;
>  
> @@ -105,6 +104,6 @@ struct commandline
>  };
>  typedef struct commandline commandline_t;
>  
> -int join(commandline_t *comline, char *envp[]);
> +int join(commandline_t *comline);
>  
>  #endif  /*  __CMAN_TOOL_DOT_H__  */
> diff --git a/cman/cman_tool/join.c b/cman/cman_tool/join.c
> index 872528b..b92090c 100644
> --- a/cman/cman_tool/join.c
> +++ b/cman/cman_tool/join.c
> @@ -1,4 +1,5 @@
>  #include <errno.h>
> +#include <unistd.h>
>  #include <sys/wait.h>
>  #include <stdint.h>
>  #include <signal.h>
> @@ -119,7 +120,7 @@ static int check_corosync_status(pid_t pid)
>  	return status;
>  }
>  
> -int join(commandline_t *comline, char *main_envp[])
> +int join(commandline_t *comline)
>  {
>  	int i, err;
>  	int envptr = 0;
> @@ -205,9 +206,9 @@ int join(commandline_t *comline, char *main_envp[])
>  
>  	/* Copy any COROSYNC_* env variables to the new daemon */
>  	i=0;
> -	while (i < MAX_ARGS && main_envp[i]) {
> -		if (strncmp(main_envp[i], "COROSYNC_", 9) == 0)
> -			envp[envptr++] = main_envp[i];
> +	while (i < MAX_ARGS && __environ[i]) {
> +		if (strncmp(__environ[i], "COROSYNC_", 9) == 0)
> +			envp[envptr++] = __environ[i];
>  		i++;
>  	}
Why not just use getenv() ?

Steve.




  reply	other threads:[~2011-11-23 10:28 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
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 [this message]
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=1322044120.2797.2.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).