summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-06-20 13:48:57 -0400
committerRich Felker <dalias@aerifal.cx>2012-06-20 13:48:57 -0400
commitb3d7d062af63d833b9a984770320534719252b61 (patch)
tree7ea46d3ccef82c3ed12e37350adb391ec3857f4b /src
parentf313a1622448de578ab0b11a881f44a02c9082e6 (diff)
downloadmusl-b3d7d062af63d833b9a984770320534719252b61.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/locale/duplocale.c2
1 files changed, 1 insertions, 1 deletions
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;
}