import from branch_1_1:
authorfcusack <fcusack>
Wed, 21 Mar 2007 07:05:27 +0000 (07:05 +0000)
committerfcusack <fcusack>
Wed, 21 Mar 2007 07:05:27 +0000 (07:05 +0000)
try_dlopen() has a bug: it sometimes returns a handle if a dependency
library can't be loaded.  It also returns an error status, however
lt_dlopenext() doesn't handle this well and returns the invalid handle.
This causes a segfault instead of a graceful exit.  Update ltdl to
give an error telling the user to report the problem, so that we can
try to reproduce it and report to the libtool folks.  We could just
leave ltdl unpatched; FR will exit either way.

1  2 
libltdl/ltdl.c

diff --cc libltdl/ltdl.c
@@@ -3500,6 -3502,6 +3500,10 @@@ lt_dlopenext (filename
      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FR_DEPLIB));
      return 0; /* leaks tmp and handle */
    }
++  if (handle && errors) {
++    LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FR_DEPLIB));
++    return 0; /* leaks tmp and handle */
++  }
  
    /* If we found FILENAME, stop searching -- whether we were able to
       load the file as a module or not.  If the file exists but loading
    else
      {
        tmp[len] = LT_EOS_CHAR;
++  if (handle && errors) {
++    LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FR_DEPLIB));
++    return 0; /* leaks tmp and handle */
++  }
      }
  
    strcat(tmp, shlib_ext);