From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Wed, 23 Nov 2011 10:28:40 +0000 Subject: [Cluster-devel] [PATCH 08/41] cman_tool: don't use envp from main In-Reply-To: References: <1322043360-17037-1-git-send-email-fdinitto@redhat.com> Message-ID: <1322044120.2797.2.camel@menhir> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 > --- > :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 > #include > #include > -#include > > 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 > +#include > #include > #include > #include > @@ -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.