Skip to content
Snippets Groups Projects
Commit bc734845 authored by Simon McVittie's avatar Simon McVittie
Browse files

ld_libs_load_cache: Don't reopen cache, and fix prefix="" case


We were opening the correct ld.so.cache here (in both cases), but then
calling ld_cache_open() which would close the fd we just opened and
open libs->prefix.path instead. In the case where the prefix is set
to "" we would open whatever arbitrary string happened to have been
left in libs->prefix.path last time we used it as scratch space.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 6866e90d
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
......@@ -1120,13 +1120,12 @@ ld_libs_load_cache (ld_libs *libs, const char *path, int *code, char **message)
if( libs->prefix.len == 0 )
{
libs->ldcache.fd = open( path, O_RDONLY );
safe_strncpy( libs->prefix.path, path, sizeof(libs->prefix.path) );
}
else
{
safe_strncpy( libs->prefix.path + libs->prefix.len,
path, PATH_MAX - libs->prefix.len );
libs->ldcache.fd = open( libs->prefix.path, O_RDONLY );
}
rv = ld_cache_open( &libs->ldcache, libs->prefix.path, code, message );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment