Index: /trunk/psLib/src/types/psMetadataConfig.c
===================================================================
--- /trunk/psLib/src/types/psMetadataConfig.c	(revision 8776)
+++ /trunk/psLib/src/types/psMetadataConfig.c	(revision 8777)
@@ -10,6 +10,6 @@
 *  @author Eric Van Alst, MHPCC
 *
-*  @version $Revision: 1.80 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-09-08 02:13:20 $
+*  @version $Revision: 1.81 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-09-08 02:59:29 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -1172,4 +1172,13 @@
     // XXX yes, mmap is evil
     void *file = mmap(0, (size_t)buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+    if (file == MAP_FAILED) {
+        psError(PS_ERR_IO, true, _("failed to mmap() file %s"), filename);
+        if (close(fd) != 0) {
+            // XXX really should return strerror() here
+            psError(PS_ERR_IO, true, _("Failed to close file '%s'."), filename);
+            return NULL;
+        }
+        return NULL;
+    }
 
     md = psMetadataConfigParse(md, nFail, (char *)file, overwrite);
