summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5private.h3
-rw-r--r--src/H5system.c2
-rw-r--r--test/links.c19
3 files changed, 16 insertions, 8 deletions
diff --git a/src/H5private.h b/src/H5private.h
index 734290d..6a5590b 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -649,8 +649,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#endif
#define HDgetegid() getegid()
#define HDgetenv(S) getenv(S)
-#define HDsetenv(S,V,O) setenv(S,V,O)
-#define HDunsetenv(S) unsetenv(S)
+#define HDputenv(S) putenv(S)
#define HDgeteuid() geteuid()
#define HDgetgid() getgid()
#define HDgetgrgid(G) getgrgid(G)
diff --git a/src/H5system.c b/src/H5system.c
index d65103a..4a49d71 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -582,6 +582,7 @@ HDremove_all(const char *fname)
/*
+ *-------------------------------------------------------------------------
*
* Function: H5_build_extpath
*
@@ -596,6 +597,7 @@ HDremove_all(const char *fname)
*
* Programmer: Vailin Choi
* April 2, 2008
+ *-------------------------------------------------------------------------
*/
#define MAX_PATH_LEN 1024
diff --git a/test/links.c b/test/links.c
index d517b4d..f940bb1 100644
--- a/test/links.c
+++ b/test/links.c
@@ -2604,6 +2604,10 @@ external_link_env(hid_t fapl, hbool_t new_format)
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group IDs */
char *envval=NULL;
+ static char *new_env = "HDF5_EXT_PREFIX=.:tmp";
+ static char *env_var = "HDF5_EXT_PREFIX";
+ static envstring[NAME_BUF_SIZE];
+
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE],
filename3[NAME_BUF_SIZE];
@@ -2641,8 +2645,10 @@ external_link_env(hid_t fapl, hbool_t new_format)
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* get original value for the HDF library environment variable for external link if set */
- envval = HDgetenv("HDF5_EXT_PREFIX");
- setenv("HDF5_EXT_PREFIX", ".:tmp", 1);
+ envval = HDgetenv(env_var);
+ if (HDputenv(new_env) < 0)
+ TEST_ERROR
+
/* Open object through external link */
H5E_BEGIN_TRY {
@@ -2650,10 +2656,11 @@ external_link_env(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* restore value for the environment variable as needed */
- if (envval)
- HDsetenv("HDF5_EXT_PREFIX", envval, 1);
- else
- HDunsetenv("HDF5_EXT_PREFIX");
+ if ((envval != NULL) && (*envval)) {
+ sprintf(envstring, "%s=%s", env_var, envval);
+ if (HDputenv(envstring) < 0)
+ TEST_ERROR
+ }
/* should be able to find the target file from pathnames set via environment variable */
if (gid < 0) {