changeset 967:bbc08d58325a

merge
author Thomas Klausner <tk@giga.or.at>
date Sun, 10 Mar 2013 09:57:57 +0100
parents 992ef1167344 (current diff) 6e7437162f26 (diff)
children 652713ce3596
files libfdcore/fdd.y
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libfdcore/fdd.y	Sat Mar 09 16:55:20 2013 +0100
+++ b/libfdcore/fdd.y	Sun Mar 10 09:57:57 2013 +0100
@@ -322,15 +322,18 @@
 					CHECK_MALLOC_DO( fname = malloc( strlen(bkp) + strlen(DEFAULT_EXTENSIONS_PATH) + 2 ),
 						{ yyerror (&yylloc, conf, "Not enough memory"); YYERROR; } );
 					sprintf(fname, DEFAULT_EXTENSIONS_PATH "/%s", bkp);
-					free(bkp);
 					fd = fopen(fname, "r");
+					if (fd == NULL) {
+						free(fname);
+						fname = bkp;
+					} else {
+						free(bkp);
+					}
 				}
-				if (fd == NULL) {
-					int ret = errno;
-					TRACE_DEBUG_ERROR("WARNING: Unable to open extension file %s for reading: %s\nLD_LIBRARY_PATH will be used.\n", fname, strerror(ret));
-				} else {
+				if (fd != NULL) {
 					fclose(fd);
-				}
+				} /* otherwise, LD_LIBRARY_PATH will be tested by dl_open. 
+				This should not give any security issue, otherwise we can add an "else fail" here. */
 				
 				/* Try and open the configuration file (optional) */
 				cfname = $4;
"Welcome to our mercurial repository"