aboutsummaryrefslogtreecommitdiffstats
path: root/elf/elftest.c
diff options
context:
space:
mode:
authorStefan Bucur <stefanb@zytor.com>2008-06-17 17:09:18 +0300
committerStefan Bucur <stefanb@zytor.com>2008-06-17 17:09:18 +0300
commitb909bc581aae81ec0444c8c2415efa69a7cf3154 (patch)
tree3c8dde5f5a42fae135a6fb44ceeff278ab2e18a5 /elf/elftest.c
parent08d0c8a562fc40b7e4e6c344cda9d1f62ef45c8d (diff)
downloadsyslinux-elf-b909bc581aae81ec0444c8c2415efa69a7cf3154.tar.gz
syslinux-elf-b909bc581aae81ec0444c8c2415efa69a7cf3154.tar.xz
syslinux-elf-b909bc581aae81ec0444c8c2415efa69a7cf3154.zip
Module unloading & cleanup, and dependency info.elflink-old
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;