about summary refs log tree commit diff
path: root/elf/dlopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dlopen.c')
-rw-r--r--elf/dlopen.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/elf/dlopen.c b/elf/dlopen.c
index c2cf8cd58d..4963e9962e 100644
--- a/elf/dlopen.c
+++ b/elf/dlopen.c
@@ -21,15 +21,31 @@
 #include <link.h>
 #include <dlfcn.h>
 
-void *
-dlopen (const char *file, int mode)
+struct dlopen_args
 {
+  /* The arguments for dlopen_doit.  */
+  const char *file;
+  int mode;
+  /* The return value of dlopen_doit.  */
   struct link_map *new;
+};
+
 
-  void doit (void)
-    {
-      new = _dl_open (file ?: "", mode);
-    }
+static void
+dlopen_doit (void *a)
+{
+  struct dlopen_args *args = (struct dlopen_args *) a;
+
+  args->new = _dl_open (args->file ?: "", args->mode);
+}
+
+
+void *
+dlopen (const char *file, int mode)
+{
+  struct dlopen_args args;
+  args.file = file;
+  args.mode = mode;
 
-  return _dlerror_run (doit) ? NULL : new;
+  return _dlerror_run (dlopen_doit, &args) ? NULL : args.new;
 }