Changeset 15411
- Timestamp:
- Oct 29, 2007, 11:36:02 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/types/psMetadataConfig.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psMetadataConfig.c
r14983 r15411 11 11 * @author Joshua Hoblitt, University of Hawaii 2006-2007 12 12 * 13 * @version $Revision: 1.14 0$ $Name: not supported by cvs2svn $14 * @date $Date: 2007- 09-22 03:05:50$13 * @version $Revision: 1.141 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2007-10-29 21:36:02 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 26 26 #include <limits.h> 27 27 #include <strings.h> 28 #ifdef USE_MMAP_TO_READ_FILE 28 29 #include <sys/mman.h> 29 30 #include <sys/stat.h> 30 31 #include <fcntl.h> 31 32 #include <unistd.h> 33 #else 34 #include "psSlurp.h" 35 #endif 32 36 33 37 #include "psMemory.h" … … 1177 1181 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 1178 1182 1183 #ifdef USE_MMAP_TO_READ_FILE 1179 1184 // Attempt to open specified file 1180 1185 int fd = 0; … … 1220 1225 return NULL; 1221 1226 } 1222 1223 bool success = true; 1227 #else 1228 psString file = psSlurpFilename(filename); 1229 #endif 1224 1230 1225 1231 md = psMetadataConfigParse(md, nFail, (char *)file, overwrite); 1226 1232 if (!md) { 1227 1233 psError(PS_ERR_IO, true, _("failed to parse file '%s'"), filename); 1228 success = false; 1229 } 1230 1234 psFree(md); 1235 return false; 1236 } 1237 1238 #ifdef USE_MMAP_TO_READ_FILE 1231 1239 if (munmap(file, nBytes) != 0) { 1232 1240 psError(PS_ERR_IO, true, _("failed to munmap file '%s'"), filename); 1233 success = false; 1241 psFree(md); 1242 return false; 1234 1243 } 1235 1244 1236 1245 if (close(fd) != 0) { 1237 1246 psError(PS_ERR_IO, true, _("Failed to close file '%s'."), filename); 1238 success = false;1239 }1240 1241 if (!success) { 1242 psFree (md);1243 return NULL; 1244 } 1247 psFree(md); 1248 return false; 1249 } 1250 #else 1251 psFree(file); 1252 #endif 1253 1245 1254 return md; 1246 1255 }
Note:
See TracChangeset
for help on using the changeset viewer.
