diff options
Diffstat (limited to 'extra/locale/gen_wc8bit.c')
-rw-r--r-- | extra/locale/gen_wc8bit.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/extra/locale/gen_wc8bit.c b/extra/locale/gen_wc8bit.c index 349f7cf7c..a861caac4 100644 --- a/extra/locale/gen_wc8bit.c +++ b/extra/locale/gen_wc8bit.c @@ -112,9 +112,10 @@ int main(int argc, char **argv) goto locale_failure; len = strlen(buf); - if (buf[len - 1] == '\n') + if (len > 0 && buf[len - 1] == '\n') buf[--len] = '\0'; - strcat(buf, ".UTF8"); + if (len < 5 || strcasecmp(&buf[len-5], ".UTF8") != 0) + strcat(buf, ".UTF8"); if (setlocale(LC_CTYPE, buf)) goto locale_success; } |