diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2008-04-04 18:48:15 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2008-04-04 18:48:15 (GMT) |
commit | bcba07c53ed22dfe52681c2e1bc72e9a587c2fec (patch) | |
tree | ac799bb228ff8dff2ececb02b61065cb3fe64ae4 | |
parent | cff7516ca7fe980f53037886b8a1faa181d6daec (diff) | |
download | hdf5-bcba07c53ed22dfe52681c2e1bc72e9a587c2fec.zip hdf5-bcba07c53ed22dfe52681c2e1bc72e9a587c2fec.tar.gz hdf5-bcba07c53ed22dfe52681c2e1bc72e9a587c2fec.tar.bz2 |
[svn-r14795] Use putenv() instead of setenv() in src/links.c
(sol does not support setenv())
-rw-r--r-- | src/H5private.h | 3 | ||||
-rw-r--r-- | test/links.c | 19 |
2 files changed, 11 insertions, 11 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/test/links.c b/test/links.c index d517b4d..fec25a1 100644 --- a/test/links.c +++ b/test/links.c @@ -2603,7 +2603,11 @@ 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 *old_env = "HDF5_EXT_PREFIX="; + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE]; @@ -2640,21 +2644,18 @@ external_link_env(hid_t fapl, hbool_t new_format) /* Create external link to target file */ 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); + if (HDputenv(new_env) < 0) + TEST_ERROR + /* Open object through external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); } 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 (HDputenv(old_env) < 0) + TEST_ERROR + /* should be able to find the target file from pathnames set via environment variable */ if (gid < 0) { H5_FAILED(); |