From b3d7d062af63d833b9a984770320534719252b61 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 20 Jun 2012 13:48:57 -0400 Subject: [PATCH] duplocale: don't crash when called with LC_GLOBAL_LOCALE posix has resolved to add this usage; for now, we just avoid writing anything to the new locale object since it's not used anyway. --- src/locale/duplocale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locale/duplocale.c b/src/locale/duplocale.c index dd445d46..5f01e137 100644 --- a/src/locale/duplocale.c +++ b/src/locale/duplocale.c @@ -6,6 +6,6 @@ locale_t duplocale(locale_t old) { locale_t new; new = calloc(1, sizeof *new); - if (new) memcpy(new, old, sizeof *new); + if (new && old != LC_GLOBAL_LOCALE) memcpy(new, old, sizeof *new); return new; } -- 2.25.1