aboutsummaryrefslogtreecommitdiffstats
path: root/elf/elftest.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/elftest.c')
-rw-r--r--elf/elftest.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/elf/elftest.c b/elf/elftest.c
index 7013938e..0a38bbe6 100644
--- a/elf/elftest.c
+++ b/elf/elftest.c
@@ -37,6 +37,7 @@ void test_hello() {
int main(int argc, char **argv) {
int res;
+ int i;
struct elf_module *module;
const char *module_name = NULL;
@@ -56,8 +57,8 @@ int main(int argc, char **argv) {
exit(1);
}
- while (argc > 0) {
- module_name = argv[0];
+ for (i=0; i < argc; i++){
+ module_name = argv[i];
module = module_alloc(module_name);
@@ -73,12 +74,22 @@ int main(int argc, char **argv) {
goto error;
}
- argc--;
- argv++;
}
test_hello();
+ for (i=argc-1; i >= 0; i--) {
+ module_name = argv[i];
+ module = module_find(module_name);
+
+ res = module_unload(module);
+
+ if (res < 0) {
+ fprintf(stderr, "Could not unload the module\n");
+ goto error;
+ }
+ }
+
modules_term();
return 0;