Skip to content

Instantly share code, notes, and snippets.

@fumiyas
Created May 11, 2012 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fumiyas/2658915 to your computer and use it in GitHub Desktop.
Save fumiyas/2658915 to your computer and use it in GitHub Desktop.
[PATCH] libiconv-1.10-ja detects a false ENOMEM error
iconv_open() detects a false ENOMEM error on aliases_lookup_with_env()
if errno is already set to ENOMEM and getenv("CHARSET_ALIAS")
returns NULL.
-- SATOH Fumiyasu @ OSS Technology, Inc., 2009-03-26
diff -rup libiconv-1.10-ja/lib/iconv.c libiconv-1.10-ja-errno/lib/iconv.c
--- libiconv-1.10-ja/lib/iconv.c 2009-03-25 21:06:55.000000000 +0900
+++ libiconv-1.10-ja-errno/lib/iconv.c 2009-03-25 21:06:16.000000000 +0900
@@ -246,6 +246,8 @@ aliases_lookup_with_env (register const
char *new_name;
const struct alias *ap = NULL;
+ errno = 0;
+
charset_alias = getenv("CHARSET_ALIAS");
if (!charset_alias) {
return NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment