Fix a HUGE bug in ltdl, which would give the wrong f*cking
authoraland <aland>
Thu, 26 Feb 2004 18:22:14 +0000 (18:22 +0000)
committeraland <aland>
Thu, 26 Feb 2004 18:22:14 +0000 (18:22 +0000)
error message when it couldn't link to a library.

The bug is fixed in newer versions of libltdl, but we haven't
upgraded because of other issues.

Bug found by Paul Stewart, and verified to be fixed in newer
versions of the software.

libltdl/ltdl.c

index 19293f4..f3f8f2c 100644 (file)
@@ -2250,10 +2250,10 @@ find_handle_callback (filename, data, ignored)
      lt_ptr ignored;
 {
   lt_dlhandle  *handle = (lt_dlhandle *) data;
-  int          found   = access (filename, R_OK);
+  int          got_access_error        = access (filename, R_OK);
 
   /* Bail out if file cannot be read...  */
-  if (!found)
+  if (got_access_error)
     return 0;
 
   /* Try to dlopen the file, but do not continue searching in any
@@ -2960,7 +2960,7 @@ lt_dlopenext (filename)
      failed, it is better to return an error message here than to
      report FILE_NOT_FOUND when the alternatives (foo.so etc) are not
      in the module search path.  */
-  if (handle || ((errors > 0) && file_not_found ()))
+  if (handle || ((errors > 0) && !file_not_found ()))
     {
       LT_DLFREE (tmp);
       return handle;