[svn-commits] tilghman: branch 1.2 r59299 - /branches/1.2/res/res_odbc.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Mar 29 08:33:10 MST 2007


Author: tilghman
Date: Thu Mar 29 10:33:10 2007
New Revision: 59299

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59299
Log:
Change ENV section to use setenv, instead of putenv (Alexandru Pirvulescu <sigxcpu at gmail.com>, reported via -dev list)

Modified:
    branches/1.2/res/res_odbc.c

Modified: branches/1.2/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/res/res_odbc.c?view=diff&rev=59299&r1=59298&r2=59299
==============================================================================
--- branches/1.2/res/res_odbc.c (original)
+++ branches/1.2/res/res_odbc.c Thu Mar 29 10:33:10 2007
@@ -251,7 +251,6 @@
 	char *cat, *dsn, *username, *password;
 	int enabled;
 	int connect = 0;
-	char *env_var;
 
 	odbc_obj *obj;
 
@@ -260,16 +259,10 @@
 		for (cat = ast_category_browse(config, NULL); cat; cat=ast_category_browse(config, cat)) {
 			if (!strcmp(cat, "ENV")) {
 				for (v = ast_variable_browse(config, cat); v; v = v->next) {
-					env_var = malloc(strlen(v->name) + strlen(v->value) + 2);
-					if (env_var) {
-						sprintf(env_var, "%s=%s", v->name, v->value);
-						ast_log(LOG_NOTICE, "Adding ENV var: %s=%s\n", v->name, v->value);
-						putenv(env_var);
-						free(env_var);
-					}
+					setenv(v->name, v->value, 1);
 				}
 
-			cat = ast_category_browse(config, cat);
+				cat = ast_category_browse(config, cat);
 			}
 
 			dsn = username = password = NULL;



More information about the svn-commits mailing list