Browse code

core: fixed overwriting mpath value given in command line via config

- -L is in the group of options evaluated before config

Daniel-Constantin Mierla authored on 01/10/2014 14:53:44
Showing 3 changed files
... ...
@@ -1651,15 +1651,25 @@ module_stm:
1651 1651
 	}
1652 1652
 	| LOADMODULE error	{ yyerror("string expected"); }
1653 1653
 	| LOADPATH STRING {
1654
-		DBG("loading modules under %s\n", $2);
1655
-		printf("loading modules under %s\n", $2);
1656
-		mods_dir = $2;
1654
+		if(mods_dir_cmd==0) {
1655
+			DBG("loading modules under %s\n", $2);
1656
+			printf("loading modules under config path: %s\n", $2);
1657
+			mods_dir = $2;
1658
+		} else {
1659
+			DBG("ignoring mod path given in config: %s\n", $2);
1660
+			printf("loading modules under command line path: %s\n", mods_dir);
1661
+		}
1657 1662
 	}
1658 1663
 	| LOADPATH error	{ yyerror("string expected"); }
1659 1664
 	| LOADPATH EQUAL STRING {
1660
-		DBG("loading modules under %s\n", $3);
1661
-		printf("loading modules under %s\n", $3);
1662
-		mods_dir = $3;
1665
+		if(mods_dir_cmd==0) {
1666
+			DBG("loading modules under %s\n", $3);
1667
+			printf("loading modules under config path: %s\n", $3);
1668
+			mods_dir = $3;
1669
+		} else {
1670
+			DBG("ignoring mod path given in config: %s\n", $3);
1671
+			printf("loading modules under command line path: %s\n", mods_dir);
1672
+		}
1663 1673
 	}
1664 1674
 	| LOADPATH EQUAL error	{ yyerror("string expected"); }
1665 1675
 	| MODPARAM LPAREN STRING COMMA STRING COMMA STRING RPAREN {
... ...
@@ -44,6 +44,7 @@
44 44
 
45 45
 
46 46
 extern char* mods_dir;   /* directory with dyn. loadable modules */
47
+extern int mods_dir_cmd; /* marker if mods dir was set in command line */
47 48
 extern char* cfg_file;
48 49
 extern int config_check;
49 50
 extern char* stat_file;
... ...
@@ -337,6 +337,7 @@ int own_pgid = 0; /* whether or not we have our own pgid (and it's ok
337 337
 					 to use kill(0, sig) */
338 338
 
339 339
 char* mods_dir = MODS_DIR;  /* search path for dyn. loadable modules */
340
+int   mods_dir_cmd = 0; /* mods dir path set in command lin e*/
340 341
 
341 342
 char* cfg_file = 0;
342 343
 unsigned int maxbuffer = MAX_RECV_BUFFER_SIZE; /* maximum buffer size we do
... ...
@@ -1939,6 +1940,7 @@ int main(int argc, char** argv)
1939 1939
 					break;
1940 1940
 			case 'L':
1941 1941
 					mods_dir = optarg;
1942
+					mods_dir_cmd = 1;
1942 1943
 					break;
1943 1944
 			case 'm':
1944 1945
 					shm_mem_size=strtol(optarg, &tmp, 10) * 1024 * 1024;