[03/12] elf: split _dl_check_loaded() from _dl_map_object
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
This is a purely mechanical split of a reusable code part.
No functional changes.
The test-suite was run on x86_64/64 and showed no regressions.
Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
---
elf/dl-load.c | 39 +++++++++++++++++++++++++--------------
1 file changed, 25 insertions(+), 14 deletions(-)
@@ -1988,23 +1988,11 @@ open_path (const char *name, size_t namelen, int mode,
return -1;
}
-/* Map in the shared object file NAME. */
-
-struct link_map *
-_dl_map_object (struct link_map *loader, const char *name,
- int type, int trace_mode, int mode, Lmid_t nsid)
+static struct link_map *
+_dl_check_loaded(const char *name, Lmid_t nsid)
{
- int fd;
- const char *origname = NULL;
- char *realname;
- char *name_copy;
struct link_map *l;
- struct filebuf fb;
-
- assert (nsid >= 0);
- assert (nsid < GL(dl_nns));
- /* Look for this name among those already loaded. */
for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
{
/* If the requested name matches the soname of a loaded object,
@@ -2033,6 +2021,29 @@ _dl_map_object (struct link_map *loader, const char *name,
/* We have a match. */
return l;
}
+ return NULL;
+}
+
+/* Map in the shared object file NAME. */
+
+struct link_map *
+_dl_map_object (struct link_map *loader, const char *name,
+ int type, int trace_mode, int mode, Lmid_t nsid)
+{
+ int fd;
+ const char *origname = NULL;
+ char *realname;
+ char *name_copy;
+ struct link_map *l;
+ struct filebuf fb;
+
+ assert (nsid >= 0);
+ assert (nsid < GL(dl_nns));
+
+ /* Look for this name among those already loaded. */
+ l = _dl_check_loaded (name, nsid);
+ if (l)
+ return l;
/* Display information if we are debugging. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)