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

resolve_link: Use build_filename


This avoids reinventing it.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 2d56075c
Branches
Tags
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
......@@ -228,30 +228,17 @@ int resolve_link(const char *prefix, char *path)
if( rl[0] == '/' )
{
const int pl = strlen( prefix );
if( pl + rv > PATH_MAX )
if( build_filename( path, PATH_MAX, prefix, rl, NULL ) >= PATH_MAX )
{
rv = -1;
goto out;
}
safe_strncpy( path, prefix, PATH_MAX );
safe_strncpy( path + pl, rl, PATH_MAX - pl );
}
else
{
const int pl = strlen( dir );
if( pl + rv + 1 > PATH_MAX )
if( build_filename( path, PATH_MAX, dir, rl, NULL ) >= PATH_MAX )
{
rv = -1;
goto out;
}
safe_strncpy( path, dir, PATH_MAX );
path[ pl ] = '/';
safe_strncpy( path + pl + 1, rl, PATH_MAX - pl - 1 );
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment