diff options
Diffstat (limited to 'catgets/catgets.c')
-rw-r--r-- | catgets/catgets.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/catgets/catgets.c b/catgets/catgets.c index a9425e4..9228f97 100644 --- a/catgets/catgets.c +++ b/catgets/catgets.c @@ -84,8 +84,17 @@ catopen (const char *cat_name, int flag) } nlspath = __secure_getenv ("NLSPATH"); - result->nlspath = __strdup (nlspath != NULL && *nlspath != '\0' - ? nlspath : NLSPATH); + if (nlspath != NULL && *nlspath != '\0') + { + /* Append the system dependent directory. */ + size_t len = strlen (nlspath + 1 + sizeof NLSPATH); + char *tmp = alloca (len); + + __stpcpy (__stpcpy (__stpcpy (tmp, nlspath), ":"), NLSPATH); + nlspath = tmp; + } + else + result->nlspath = __strdup (NLSPATH); if (result->nlspath == NULL) { |