Changeset 16909 for gsdl/trunk/common-src
- Timestamp:
- 2008-08-20T10:30:21+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/common-src/src/lib/gsdltools.cpp
r16895 r16909 169 169 170 170 static bool gsdl_setenv_done = false; 171 static char* retain_gsdlosc = NULL; 172 static char* retain_gsdlhomec = NULL; 173 static char* retain_pathc = NULL; 171 174 172 175 bool set_gsdl_env_vars (const text_t& gsdlhome) … … 207 210 } 208 211 209 // these will be cleaned up in the destructor 210 char* gsdlosc = gsdlos.getcstr(); 211 char* gsdlhomec = gsdlhome.getcstr(); 212 char* pathc = path.getcstr(); 212 text_t putpath = "PATH=" + path; 213 text_t putgsdlos = "GSDLOS=" + gsdlos; 214 text_t putgsdlhome = "GSDLHOME=" + gsdlhome; 215 216 retain_gsdlosc = putgsdlos.getcstr(); 217 retain_gsdlhomec = putgsdlhome.getcstr(); 218 retain_pathc = path.getcstr(); 213 219 214 if ((setenv("GSDLOS",gsdlosc,1)!=0) 215 || (setenv("GSDLHOME",gsdlhomec,1)!=0) 216 || (setenv("PATH",pathc,1)!=0)) 220 if ((putenv(retain_gsdlosc)!=0) || (putenv(retain_gsdlhomec)!=0) 221 || (putenv(retain_pathc)!=0)) 217 222 { 218 perror("Setting Greenstone environment variables ");223 perror("Setting Greenstone environment variables with putenv()"); 219 224 return false; 220 225 } 221 226 222 delete [] gsdlosc;223 delete [] gsdlhomec;224 delete [] pathc;227 // Need to keep memory allocated setgsdlosc, setgsdlhomec or pathc around 228 // (i.e. can't delete them). This is because putenv() doesn't take 229 // a copy, but places them in the actual environment. 225 230 226 231 gsdl_setenv_done = true;
Note:
See TracChangeset
for help on using the changeset viewer.