From: Ulrich Drepper Date: Mon, 17 Mar 1997 03:41:49 +0000 (+0000) Subject: (catopen): Always add NLSPATH to search path for catalogs, not only if X-Git-Tag: cvs/glibc-2_0_4~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff407b13b9cd6277d6221d1c180866aedb6839cb;p=thirdparty%2Fglibc.git (catopen): Always add NLSPATH to search path for catalogs, not only if the envvar NLSPATH is not available. --- diff --git a/catgets/catgets.c b/catgets/catgets.c index b8e5bf0750c..9228f970d62 100644 --- a/catgets/catgets.c +++ b/catgets/catgets.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . @@ -34,6 +34,7 @@ catopen (const char *cat_name, int flag) { __nl_catd result; const char *env_var; + const char *nlspath; result = (__nl_catd) malloc (sizeof (*result)); if (result == NULL) @@ -82,8 +83,16 @@ catopen (const char *cat_name, int flag) return (nl_catd) -1; } - if (__secure_getenv ("NLSPATH") != NULL) - result->nlspath = __strdup (getenv ("NLSPATH")); + nlspath = __secure_getenv ("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);