]> granicus.if.org Git - transmission/commitdiff
(trunk libT) fix getConfigDir() bug reported by wereHamster
authorCharles Kerr <charles@transmissionbt.com>
Fri, 9 Jan 2009 19:16:52 +0000 (19:16 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Fri, 9 Jan 2009 19:16:52 +0000 (19:16 +0000)
cli/cli.c
daemon/daemon.c

index a96ea3fac90c6a1e30f490742c0215fbabe8902a..6df904febb5d7656b67413597c68826d43994328 100644 (file)
--- a/cli/cli.c
+++ b/cli/cli.c
@@ -48,7 +48,6 @@ static sig_atomic_t manualUpdate     = 0;
 static const char * torrentPath  = NULL;
 static const char * finishCall   = NULL;
 static const char * announce     = NULL;
-static const char * configdir    = NULL;
 static const char * sourceFile   = NULL;
 static const char * comment      = NULL;
 
@@ -272,9 +271,12 @@ getConfigDir( int argc, const char ** argv )
     const char * optarg;
     const int ind = tr_optind;
 
-    while(( c = tr_getopt( getUsage( ), argc, argv, options, &optarg )))
-        if( c == 'g' )
-            configdir = optarg;
+    while(( c = tr_getopt( getUsage( ), argc, argv, options, &optarg ))) {
+        if( c == 'g' ) {
+            configDir = optarg;
+            break;
+        }
+    }
 
     tr_optind = ind;
 
index 569b957fa27bfd76d77c50cb0a56618e2f2cce86..f61a9b94596ac5d8591f919c42d6e1b75e166f23 100644 (file)
@@ -156,9 +156,12 @@ getConfigDir( int argc, const char ** argv )
     const char * optarg;
     const int ind = tr_optind;
 
-    while(( c = tr_getopt( getUsage( ), argc, argv, options, &optarg )))
-        if( c == 'g' )
+    while(( c = tr_getopt( getUsage( ), argc, argv, options, &optarg ))) {
+        if( c == 'g' ) {
             configDir = optarg;
+            break;
+        }
+    }
 
     tr_optind = ind;