1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
diff -ru GraphicsMagick-1.3.38.orig/magick/module.c GraphicsMagick-1.3.38/magick/module.c
--- GraphicsMagick-1.3.38.orig/magick/module.c 2022-03-26 18:45:36.000000000 +0100
+++ GraphicsMagick-1.3.38/magick/module.c 2022-11-05 20:08:54.097212410 +0100
@@ -47,12 +47,9 @@
#include "magick/map.h"
#include "magick/module.h"
#include "magick/utility.h"
-#if defined(HasLTDL)
-# include "ltdl.h"
- typedef lt_dlhandle ModuleHandle;
-#else
- typedef void *ModuleHandle;
-#endif
+
+#include <dlfcn.h>
+typedef void *ModuleHandle;
/*
Define declarations.
@@ -60,7 +57,7 @@
#define MAX_MODULES 511 /* Maximum number of modules supported by build. */
#define ModuleFilename "modules.mgk"
#if defined(HasLTDL)
-# define ModuleGlobExpression "*.la"
+# define ModuleGlobExpression "*.so"
#else
# if defined(_DEBUG)
# define ModuleGlobExpression "IM_MOD_DB_*.dll"
@@ -297,9 +294,6 @@
*/
if (ltdl_initialized)
{
-#if !defined(HasJP2)
- (void) lt_dlexit();
-#endif
ltdl_initialized=False;
}
}
@@ -375,13 +369,13 @@
return(MagickFail);
/* Open the module */
- handle=lt_dlopen(module_path);
+ handle=dlopen(module_path, RTLD_NOW);
if (handle == (ModuleHandle) NULL)
{
char
message[MaxTextExtent];
- FormatString(message,"\"%.256s: %.256s\"",module_path,lt_dlerror());
+ FormatString(message,"\"%.256s: %.256s\"",module_path,dlerror());
ThrowException(&(*image)->exception,ModuleError,UnableToLoadModule,
message);
return(status);
@@ -401,7 +395,7 @@
FormatString(method_name,"%.64sImage",tag);
#endif
method=(unsigned int (*)(Image **,const int,char **))
- lt_dlsym(handle,method_name);
+ dlsym(handle,method_name);
/* Execute module method */
@@ -429,7 +423,7 @@
}
/* Close the module */
- (void) lt_dlclose(handle);
+ (void) dlclose(handle);
return(status);
}
@@ -822,9 +816,11 @@
*/
if (!ltdl_initialized)
{
+#if 0
if (lt_dlinit() != 0)
MagickFatalError(ModuleFatalError,
- UnableToInitializeModuleLoader,lt_dlerror());
+ UnableToInitializeModuleLoader,dlerror());
+#endif
ltdl_initialized=True;
}
(void) ReadModuleConfigureFile(ModuleFilename,0,&exception);
@@ -1359,8 +1355,8 @@
CoderInfo
*coder_info;
- ModuleHandle
- handle;
+ void
+ *handle;
register ModuleInfo
*p;
@@ -1419,10 +1415,10 @@
(void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
"Opening module at path \"%s\" ...", path);
- handle=lt_dlopen(path);
+ handle=dlopen(path, RTLD_NOW);
if (handle == (ModuleHandle) NULL)
{
- FormatString(message,"\"%.1024s: %.1024s\"",path,lt_dlerror());
+ FormatString(message,"\"%.1024s: %.1024s\"",path,dlerror());
ThrowException(exception,ModuleError,UnableToLoadModule,message);
return(MagickFail);
}
@@ -1432,7 +1428,7 @@
coder_info=SetCoderInfo(module_name);
if (coder_info == (CoderInfo*) NULL)
{
- (void) lt_dlclose(handle);
+ (void) dlclose(handle);
return(MagickFail);
}
coder_info->handle=handle;
@@ -1443,10 +1439,10 @@
Locate and record RegisterFORMATImage function
*/
TagToFunctionName(module_name,"Register%sImage",name);
- coder_info->register_function=(void (*)(void)) lt_dlsym(handle,name);
+ coder_info->register_function=(void (*)(void)) dlsym(handle,name);
if (coder_info->register_function == (void (*)(void)) NULL)
{
- FormatString(message,"\"%.1024s: %.1024s\"",module_name,lt_dlerror());
+ FormatString(message,"\"%.1024s: %.1024s\"",module_name,dlerror());
ThrowException(exception,ModuleError,UnableToRegisterImageFormat,
message);
return(MagickFail);
@@ -1460,10 +1456,10 @@
Locate and record UnregisterFORMATImage function
*/
TagToFunctionName(module_name,"Unregister%sImage",name);
- coder_info->unregister_function=(void (*)(void)) lt_dlsym(handle,name);
+ coder_info->unregister_function=(void (*)(void)) dlsym(handle,name);
if (coder_info->unregister_function == (void (*)(void)) NULL)
{
- FormatString(message,"\"%.1024s: %.1024s\"",module_name,lt_dlerror());
+ FormatString(message,"\"%.1024s: %.1024s\"",module_name,dlerror());
ThrowException(exception,ModuleError,UnableToRegisterImageFormat,
message);
return(MagickFail);
@@ -1983,7 +1979,7 @@
assert(tag != (char *) NULL);
assert(module_name != (char *) NULL);
#if defined(HasLTDL)
- (void) FormatString(module_name,"%.1024s.la",tag);
+ (void) FormatString(module_name,"%.1024s.so",tag);
(void) LocaleLower(module_name);
#else
#if defined(MSWINDOWS)
@@ -2030,7 +2026,7 @@
assert(tag != (char *) NULL);
assert(module_name != (char *) NULL);
#if defined(HasLTDL)
- (void) FormatString(module_name,"%.1024s.la",tag);
+ (void) FormatString(module_name,"%.1024s.so",tag);
(void) LocaleLower(module_name);
#else
(void) FormatString(module_name,"%.1024s.dll",tag);
@@ -2142,10 +2138,10 @@
*/
if ( strcmp("JP2",coder_info->tag) != 0 )
{
- if (lt_dlclose((ModuleHandle) coder_info->handle))
+ if (dlclose((ModuleHandle) coder_info->handle))
{
FormatString(message,"\"%.1024s: %.1024s\"",coder_info->tag,
- lt_dlerror());
+ dlerror());
ThrowException(exception,ModuleError,FailedToCloseModule,message);
status=False;
}
|