~ubuntu-branches/ubuntu/lucid/mpg123/lucid

« back to all changes in this revision

Viewing changes to src/module.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2009-12-21 00:11:29 UTC
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20091221001129-gsbnzbenceqv4pjt
Tags: upstream-1.10.0
ImportĀ upstreamĀ versionĀ 1.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        if(dir != NULL)
50
50
        {
51
51
                size_t l = strlen(defaultdir);
 
52
 
 
53
                if(param.verbose > 1) fprintf(stderr, "Using default module dir: %s\n", defaultdir);
52
54
                moddir = malloc(l+1);
53
55
                if(moddir != NULL)
54
56
                {
76
78
                                snprintf(moddir, l+1, "%s/%s", binpath, testpath);
77
79
 
78
80
                                moddir[l] = 0;
79
 
                                debug1("Looking for module dir: %s", moddir);
 
81
                                if(param.verbose > 1) fprintf(stderr, "Looking for module dir: %s\n", moddir);
80
82
 
81
83
                                dir = opendir(moddir);
82
84
                                closedir(dir);
86
88
                        }
87
89
                }
88
90
        }
89
 
        debug1("module dir: %s", moddir != NULL ? moddir : "<nil>");
 
91
        if(param.verbose > 1) fprintf(stderr, "Module dir: %s\n", moddir != NULL ? moddir : "<nil>");
90
92
        return moddir;
91
93
}
92
94
 
121
123
                goto om_bad;
122
124
        }
123
125
        /* Work out the path of the module to open */
124
 
        module_path_len = strlen(type) + 1 + strlen(name) + strlen(MODULE_FILE_SUFFIX) + 1;
 
126
        /* Note that we need to open ./file, not just file! */
 
127
        module_path_len = 2 + strlen(type) + 1 + strlen(name) + strlen(MODULE_FILE_SUFFIX) + 1;
125
128
        module_path = malloc( module_path_len );
126
129
        if (module_path == NULL) {
127
130
                error1( "Failed to allocate memory for module name: %s", strerror(errno) );
128
131
                goto om_bad;
129
132
        }
130
 
        snprintf( module_path, module_path_len, "%s_%s%s", type, name, MODULE_FILE_SUFFIX );
 
133
        snprintf( module_path, module_path_len, "./%s_%s%s", type, name, MODULE_FILE_SUFFIX );
131
134
        /* Display the path of the module created */
132
 
        debug1( "Module path: %s", module_path );
 
135
        if(param.verbose > 1) fprintf(stderr, "Module path: %s\n", module_path );
133
136
 
134
137
        /* Open the module */
135
138
        handle = lt_dlopen( module_path );
136
139
        free( module_path );
137
140
        if (handle==NULL) {
138
141
                error2( "Failed to open module %s: %s", name, lt_dlerror() );
 
142
                if(param.verbose > 1)
 
143
                fprintf(stderr, "Note: This could be because of braindead path in the .la file...\n");
 
144
 
139
145
                goto om_bad;
140
146
        }
141
147