src/server/safs/init.c

changeset 84
afd57ce39ec9
parent 77
f1cff81e425a
child 90
279f343bbf6c
equal deleted inserted replaced
83:28433f06d5ee 84:afd57ce39ec9
71 } 71 }
72 72
73 // load function symbols 73 // load function symbols
74 int b = 0; 74 int b = 0;
75 for(int i=0;;i++) { 75 for(int i=0;;i++) {
76 if(funcs[i] == '-') {
77 funcs[i] = '_';
78 }
76 if(funcs[i] == ',' || funcs[i] == 0) { 79 if(funcs[i] == ',' || funcs[i] == 0) {
77 if(funcs[i] == 0) { 80 if(funcs[i] == 0) {
78 b = 1; 81 b = 1;
79 } 82 }
80 83
81 funcs[i] = 0; 84 funcs[i] = 0;
82 85
83 // we have a function name 86 // we have a function name
84 void *sym = dlsym(lib, funcs); 87 void *sym = dlsym(lib, funcs);
85 if(sym == NULL) { 88 if(sym == NULL) {
86 fprintf(stderr, "Cannot load symbol %s\n", funcs); 89 fprintf(stderr, "Cannot load symbol %s\n", funcs);
90 dlclose(lib);
87 return REQ_ABORTED; 91 return REQ_ABORTED;
88 } 92 }
89 struct FuncStruct fc; 93 struct FuncStruct fc;
90 fc.func = (FuncPtr)sym; 94 fc.func = (FuncPtr)sym;
91 fc.name = sstrdup(sstr(funcs)).ptr; 95 fc.name = sstrdup(sstr(funcs)).ptr;
97 101
98 funcs += i + 1; 102 funcs += i + 1;
99 i = 0; 103 i = 0;
100 } 104 }
101 } 105 }
102 106
103 return REQ_PROCEED; 107 return REQ_PROCEED;
104 } 108 }

mercurial