All pastes #12470 Raw Edit

Untitled

public text v1 · immutable
#12470 ·published 2005-05-23 23:06 UTC
rendered paste body
Index: loader.c
===================================================================
--- loader.c    (revision 44786)
+++ loader.c    (working copy)
@@ -690,7 +690,7 @@
        /*
         * Try loading the module using a variety of names
         */
-       for (i = 0; i < 3; ++i) {
+       for (i = 0; i < 4; ++i) {
                switch (i) {
                case 0:
                        /* Try the original name */
@@ -705,6 +705,21 @@
                        else
                                continue;
                        break;
+               case 2: {
+                       /* Try fallback to just .so if we have .so.<major>... */
+                       char *ptr = strstr (new_scope, ".so.");
+
+                       if (ptr != NULL) {
+                               // Didn't want to pull in ctype
+                               if (ptr[5] >= '0' && ptr[5] <= '9') {
+                                       file_name = g_strdup (new_scope);
+                                       file_name [strlen (new_scope) - (ptr - new_scope)] = '\0';
+                               }
+                       }
+                       else
+                               continue;
+               }
+
                default:
                        if (strstr (new_scope, "lib") != new_scope) {
                                file_name = g_strdup_printf ("lib%s", new_scope);