gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnurl] 196/208: getparameter: avoid returning uninitialize


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 196/208: getparameter: avoid returning uninitialized 'usedarg'
Date: Wed, 09 Aug 2017 17:36:33 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to annotated tag gnurl-7.55.0
in repository gnurl.

commit d6c8def82a2cfc0d177acc81e4244221d4e98f2f
Author: Daniel Stenberg <address@hidden>
AuthorDate: Fri Aug 4 11:49:27 2017 +0200

    getparameter: avoid returning uninitialized 'usedarg'
    
    Fixes #1728
---
 src/tool_getparam.c | 2 +-
 src/tool_parsecfg.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index cc2d816f1..089d28574 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -443,6 +443,7 @@ ParameterError getparameter(const char *flag, /* f or 
-long-flag */
   bool toggle = TRUE; /* how to switch boolean options, on or off. Controlled
                          by using --OPTION or --no-OPTION */
 
+  *usedarg = FALSE; /* default is that we don't use the arg */
 
   if(('-' != flag[0]) ||
      (('-' == flag[0]) && ('-' == flag[1]))) {
@@ -496,7 +497,6 @@ ParameterError getparameter(const char *flag, /* f or 
-long-flag */
       letter = parse[0];
       subletter = parse[1];
     }
-    *usedarg = FALSE; /* default is that we don't use the arg */
 
     if(hit < 0) {
       for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) {
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c
index 8432e5794..93814f454 100644
--- a/src/tool_parsecfg.c
+++ b/src/tool_parsecfg.c
@@ -49,7 +49,7 @@ int parseconfig(const char *filename, struct GlobalConfig 
*global)
   int res;
   FILE *file;
   char filebuffer[512];
-  bool usedarg;
+  bool usedarg = FALSE;
   char *home;
   int rc = 0;
   struct OperationConfig *operation = global->first;
@@ -220,7 +220,7 @@ int parseconfig(const char *filename, struct GlobalConfig 
*global)
 #endif
       res = getparameter(option, param, &usedarg, global, operation);
 
-      if(param && *param && !usedarg)
+      if(!res && param && *param && !usedarg)
         /* we passed in a parameter that wasn't used! */
         res = PARAM_GOT_EXTRA_PARAMETER;
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]