[uClibc-cvs] CVS uClibc/ldso/libdl

CVS User jocke jocke at codepoet.org
Thu Oct 14 09:24:43 UTC 2004


Update of /var/cvs/uClibc/ldso/libdl
In directory nail:/tmp/cvs-serv5464

Modified Files:
	libdl.c 
Log Message:
Don't SEGV if library not found.


--- /var/cvs/uClibc/ldso/libdl/libdl.c	2004/10/03 07:52:02	1.57
+++ /var/cvs/uClibc/ldso/libdl/libdl.c	2004/10/14 09:24:43	1.58
@@ -216,20 +216,19 @@
 					fprintf(stderr, "Trying to load '%s', needed by '%s'\n",
 							lpntstr, tcurr->libname);
 #endif
-				dyn_ptr->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
-				_dl_memset (dyn_ptr->next, 0, sizeof (struct dyn_elf));
-				dyn_ptr = dyn_ptr->next;
-				dyn_ptr->dyn = tpnt1;
-				if (!tpnt1) {
+				if (tpnt1) {
+					tpnt1->usage_count++;
+				} else {
 					tpnt1 = _dl_load_shared_library(0, &rpnt, tcurr, lpntstr, 0);
-					dyn_ptr->dyn = tpnt1;
 					if (!tpnt1)
 						goto oops;
-					tpnt1->rtld_flags |= RTLD_GLOBAL;
-				} else {
-					tpnt1->rtld_flags |= RTLD_GLOBAL;
-					tpnt1->usage_count++;
 				}
+				tpnt1->rtld_flags |= RTLD_GLOBAL;
+				dyn_ptr->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
+				_dl_memset (dyn_ptr->next, 0, sizeof (struct dyn_elf));
+				dyn_ptr = dyn_ptr->next;
+				dyn_ptr->dyn = tpnt1;
+
 				tmp = alloca(sizeof(struct init_fini_list)); /* Allocates on stack, no need to free this memory */
 				tmp->tpnt = tpnt1;
 				tmp->next = tcurr->init_fini;



More information about the uClibc-cvs mailing list