summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre.ledru@scilab.org>2011-04-14 12:01:09 +0200
committerAllan CORNET <allan.cornet@scilab.org>2011-05-06 15:18:13 +0200
commit5a47ae0f044fe10d5ac61b264fb24ea7cfa216ea (patch)
tree25ce67997976fcce3e2a69a16a5a5edaf7c6a0ff
parenta0b16b26e51a9be1729af83f74cb8162e115203a (diff)
downloadscilab-5a47ae0f044fe10d5ac61b264fb24ea7cfa216ea.zip
scilab-5a47ae0f044fe10d5ac61b264fb24ea7cfa216ea.tar.gz
return of the dlclose was wrongly tested
Change-Id: I35a4462a101646b0006d0b72084dfdfca7a7152e
-rw-r--r--scilab/libs/dynamiclibrary/src/dynamiclibrary_others.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/scilab/libs/dynamiclibrary/src/dynamiclibrary_others.c b/scilab/libs/dynamiclibrary/src/dynamiclibrary_others.c
index 263122a..6654684 100644
--- a/scilab/libs/dynamiclibrary/src/dynamiclibrary_others.c
+++ b/scilab/libs/dynamiclibrary/src/dynamiclibrary_others.c
@@ -20,27 +20,33 @@
20/*---------------------------------------------------------------------------*/ 20/*---------------------------------------------------------------------------*/
21BOOL FreeDynLibrary(DynLibHandle hInstance) 21BOOL FreeDynLibrary(DynLibHandle hInstance)
22{ 22{
23 if (hInstance) 23 if (hInstance)
24 { 24 {
25 if (dlclose( hInstance)) return TRUE;
26 }
27 #ifndef NDEBUG
28 else
29 {
30 printf("FreeDynLibrary: Cannot close a not-opened library.\n");
31 fflush(NULL);
32 }
33 #endif
34 25
35 return FALSE; 26 if (dlclose( hInstance) == 0)
27 {
28 return TRUE;
29 }else{
30 fprintf(stderr,"Could not free library %s\n", dlerror());
31 }
32 }
33 #ifndef NDEBUG
34 else
35 {
36 fprintf(stderr, "FreeDynLibrary: Cannot close a not-opened library.\n");
37 fflush(NULL);
38 }
39 #endif
40
41 return FALSE;
36} 42}
37/*---------------------------------------------------------------------------*/ 43/*---------------------------------------------------------------------------*/
38DynLibFuncPtr GetDynLibFuncPtr(DynLibHandle hInstance,char *funcName) 44DynLibFuncPtr GetDynLibFuncPtr(DynLibHandle hInstance,char *funcName)
39{ 45{
40 if (hInstance) 46 if (hInstance)
41 { 47 {
42 return dlsym(hInstance, funcName); 48 return dlsym(hInstance, funcName);
43 } 49 }
44 return NULL; 50 return NULL;
45} 51}
46/*---------------------------------------------------------------------------*/ 52/*---------------------------------------------------------------------------*/