From 2eb1573f01710832bbe60a4ece89cb301727612a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 8 Dec 2010 06:26:04 -0500 Subject: hashtable: drop all non-reentrant versions The non-reentrant versions of the hashtable functions operate on a single shared hashtable. So if two different people try using these funcs for two different purposes, they'll cause problems for the other. Avoid this by converting all existing hashtable consumers over to the reentrant versions and then punting the non-reentrant ones. Signed-off-by: Mike Frysinger --- common/env_common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'common/env_common.c') diff --git a/common/env_common.c b/common/env_common.c index a276efc..ae710e5 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -129,6 +129,8 @@ uchar default_environment[] = { "\0" }; +struct hsearch_data env_htab; + static uchar env_get_char_init (int index) { uchar c; @@ -187,7 +189,7 @@ void set_default_env(const char *s) puts("Using default environment\n\n"); } - if (himport((char *)default_environment, + if (himport_r(&env_htab, (char *)default_environment, sizeof(default_environment), '\0', 0) == 0) { error("Environment import failed: errno = %d\n", errno); } @@ -213,7 +215,7 @@ int env_import(const char *buf, int check) } } - if (himport((char *)ep->data, ENV_SIZE, '\0', 0)) { + if (himport_r(&env_htab, (char *)ep->data, ENV_SIZE, '\0', 0)) { gd->flags |= GD_FLG_ENV_READY; return 1; } -- cgit v1.1