summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/setrunelocale.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-04-07 08:54:38 +0000
committerache <ache@FreeBSD.org>1997-04-07 08:54:38 +0000
commit7b1360495da7bd7306ddeea3a9ddb95a483233ae (patch)
tree8ba3017cb8ed5f902d750c3aa3a11f5ca86a887f /lib/libc/locale/setrunelocale.c
parent42b08e73160ea8e6dc0d62f41a73acb091c3cc39 (diff)
downloadFreeBSD-src-7b1360495da7bd7306ddeea3a9ddb95a483233ae.zip
FreeBSD-src-7b1360495da7bd7306ddeea3a9ddb95a483233ae.tar.gz
Restore PATH_LOCALE functionality using issetugid() call now
Diffstat (limited to 'lib/libc/locale/setrunelocale.c')
-rw-r--r--lib/libc/locale/setrunelocale.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c
index d422e39..d44f8e2 100644
--- a/lib/libc/locale/setrunelocale.c
+++ b/lib/libc/locale/setrunelocale.c
@@ -40,6 +40,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include "setlocale.h"
extern int _none_init __P((_RuneLocale *));
@@ -82,8 +83,19 @@ _xpg4_setrunelocale(encoding)
return(0);
}
- if (!_PathLocale)
- _PathLocale = _PATH_LOCALE;
+ if (_PathLocale == NULL) {
+ char *p = getenv("PATH_LOCALE");
+
+ if (p != NULL && !issetugid()) {
+ if (strlen(p) + 1/*"/"*/ + ENCODING_LEN +
+ 1/*"/"*/ + CATEGORY_LEN >= PATH_MAX)
+ return(EFAULT);
+ _PathLocale = strdup(p);
+ if (_PathLocale == NULL)
+ return (errno);
+ } else
+ _PathLocale = _PATH_LOCALE;
+ }
/* Range checking not needed, encoding length already checked above */
(void) strcpy(name, _PathLocale);
(void) strcat(name, "/");
OpenPOWER on IntegriCloud