Commit 7a1fc175 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

XlcDL.c: reduce code duplication

parent c9ebd122
......@@ -249,6 +249,7 @@ __lc_path(const char *dl_name, const char *lc_dir)
{
char *path;
size_t len;
char *slash_p;
/*
* reject this for possible security issue
......@@ -264,24 +265,21 @@ __lc_path(const char *dl_name, const char *lc_dir)
path = Xmalloc(len + 1);
if (strchr(dl_name, '/') != NULL) {
char *slash_p;
slash_p = strrchr(lc_dir, '/');
*slash_p = '\0';
} else
slash_p = NULL;
#if defined POSTLOCALELIBDIR
snprintf(path, len + 1, "%s/%s/%s.so.2",
lc_dir, POSTLOCALELIBDIR, dl_name);
snprintf(path, len + 1, "%s/%s/%s.so.2",
lc_dir, POSTLOCALELIBDIR, dl_name);
#else
snprintf(path, len + 1, "%s/%s.so.2", lc_dir, dl_name);
snprintf(path, len + 1, "%s/%s.so.2", lc_dir, dl_name);
#endif
if (slash_p != NULL)
*slash_p = '/';
} else {
#if defined POSTLOCALELIBDIR
snprintf(path, len + 1, "%s/%s/%s.so.2",
lc_dir, POSTLOCALELIBDIR, dl_name);
#else
snprintf(path, len + 1, "%s/%s.so.2", lc_dir, dl_name);
#endif
}
return path;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment