]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.c (load_deplibs): If loading a deplib fails,
authorGary V. Vaughan <gary@gnu.org>
Wed, 31 Jan 2001 11:42:38 +0000 (11:42 +0000)
committerGary V. Vaughan <gary@gnu.org>
Wed, 31 Jan 2001 11:42:38 +0000 (11:42 +0000)
don't sweat -- it may be a lib that is already statically linked
into the loading application.

* libltdl/ltdl.c: Clean up the shadowing of the global handles
variable.
(LT_DLRESIDENT_FLAGS): Add extra parens to satisfy -Wall.
(load_deplibs):  Cast isspace() argument to an int to satisfy
-Wall.

ChangeLog
libltdl/ltdl.c

index 7d3dd298edc124bf9a2289439198e6415dc2ff62..9d9cb922edecc2fe8a50e90716c64e11b1a71502 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-01-31  Gary V. Vaughan  <gvv@techie.com>
+
+       * libltdl/ltdl.c (load_deplibs): If loading a deplib fails,
+       don't sweat -- it may be a lib that is already statically linked
+       into the loading application.
+       
+       * libltdl/ltdl.c: Clean up the shadowing of the global handles
+       variable.
+       (LT_DLRESIDENT_FLAGS): Add extra parens to satisfy -Wall.
+       (load_deplibs):  Cast isspace() argument to an int to satisfy
+       -Wall.
+
 2001-01-29  Alexandre Oliva  <aoliva@redhat.com>
 
        * libltdl/Makefile.am (CLEANFILES): Clean conditionally-built
index 6c36b4126ebd8d82bce084d3492f49305a8b7924..85f0769302331311b68a5b4513b40320557d15c7 100644 (file)
@@ -142,7 +142,7 @@ struct lt_dlhandle_struct {
 
 /* Various boolean flags can be stored in the flags field of an
    lt_dlhandle_struct... */
-#define LT_DLGET_FLAG(handle, flag) ((handle)->flags&(flag) == (flag))
+#define LT_DLGET_FLAG(handle, flag) (((handle)->flags & (flag)) == (flag))
 #define LT_DLSET_FLAG(handle, flag) ((handle)->flags |= (flag))
 
 #define LT_DLRESIDENT_FLAG         (0x01 << 0)
@@ -1569,7 +1569,6 @@ load_deplibs(handle, deplibs)
   int  i;
   int  ret = 1, depcount = 0;
   char **names = 0;
-  lt_dlhandle *handles = 0;
 
   handle->depcount = 0;
   if (!deplibs)
@@ -1588,10 +1587,10 @@ load_deplibs(handle, deplibs)
   p = deplibs;
   while (*p)
     {
-      if (!isspace (*p))
+      if (!isspace ((int) *p))
        {
          char *end = p+1;
-         while (*end && !isspace(*end))
+         while (*end && !isspace((int) *end))
            {
              ++end;
            }
@@ -1631,24 +1630,19 @@ load_deplibs(handle, deplibs)
       goto cleanup;
     }
 
-  handles = (lt_dlhandle*) LT_DLMALLOC (lt_dlhandle *, depcount);
-  if (!handles)
-    {
-      goto cleanup;
-    }
   /* now only extract the actual deplibs */
   depcount = 0;
   p = deplibs;
   while (*p)
     {
-      if (isspace (*p))
+      if (isspace ((int) *p))
        {
          ++p;
        }
       else
        {
          char *end = p+1;
-         while (*end && !isspace (*end))
+         while (*end && !isspace ((int) *end))
            {
              ++end;
            }
@@ -1685,29 +1679,33 @@ load_deplibs(handle, deplibs)
        }
     }
 
-  /* load the deplibs (in reverse order) */
-  for (i = 0; i < depcount; ++i)
+  /* load the deplibs (in reverse order)
+     At this stage, don't worry if the deplibs do not load correctly,
+     they may already be statically linked into the loading application
+     for instance.  There will be a more enlightening error message
+     later on if the loaded module cannot resolve all of its symbols.  */
+  if (depcount)
     {
-      lt_dlhandle handle = lt_dlopenext(names[depcount-1-i]);
-      if (!handle)
-       {
-         int j;
-         for (j = 0; j < i; ++j)
+      int      j = 0;
+
+      handle->deplibs = (lt_dlhandle*) LT_DLMALLOC (lt_dlhandle *, depcount);
+      if (!handle->deplibs)
            {
-             lt_dlclose(handles[j]);
+         goto cleanup;
            }
 
-         last_error = LT_DLSTRERROR (DEPLIB_NOT_FOUND);
-         goto cleanup_names;
+      for (i = 0; i < depcount; ++i)
+       {
+         handle->deplibs[j] = lt_dlopenext(names[depcount-1-i]);
+         if (handle->deplibs[j])
+           {
+             ++j;
        }
-
-      handles[i] = handle;
     }
 
-  handle->depcount  = depcount;
-  handle->deplibs   = handles;
-  handles          = 0;
+      handle->depcount = j;    /* Number of successfully loaded deplibs */
   ret              = 0;
+    }
 
  cleanup_names:
   for (i = 0; i < depcount; ++i)
@@ -1717,7 +1715,6 @@ load_deplibs(handle, deplibs)
 
  cleanup:
   LT_DLFREE (names);
-  LT_DLFREE (handles);
 
   /* restore the old search path */
   LT_DLFREE (user_search_path);