-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
DEFINE_TEST(test_I) | ||
{ | ||
const char *reffile = "test_I.zip"; | ||
const char *lang; | ||
int r; | ||
|
||
#if HAVE_SETLOCALE | ||
|
@@ -44,11 +45,18 @@ DEFINE_TEST(test_I) | |
skipping("setlocale() not available on this system."); | ||
#endif | ||
|
||
lang = getenv("LANG"); | ||
setenv("LANG", "en_US.UTF-8", 1); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mmatuska
Author
Member
|
||
extract_reference_file(reffile); | ||
r = systemf("%s -I UTF-8 %s >test.out 2>test.err", testprog, reffile); | ||
assertEqualInt(0, r); | ||
assertNonEmptyFile("test.out"); | ||
assertEmptyFile("test.err"); | ||
|
||
assertTextFileContents("Hello, World!\n", "Γειά σου Κόσμε.txt"); | ||
|
||
if (lang == NULL) | ||
unsetenv("LANG"); | ||
else | ||
setenv("LANG", lang, 1); | ||
} |
This
setenv()
call may clobber the memory pointed to bylang
.It is also insufficient, since you don't run in a clean environment, so
LANG
may be overridden by an inheritedLC_ALL
orLC_CTYPE
, or by the user's.profile
(remember thatsystem()
does not execute the command directly, but passes it to a shell).