[mapserver-commits] r11426 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Mar 31 09:27:53 EDT 2011


Author: tbonfort
Date: 2011-03-31 06:27:53 -0700 (Thu, 31 Mar 2011)
New Revision: 11426

Modified:
   trunk/mapserver/mapfile.c
Log:
fix compiler warning ignoring return value of getcwd()


Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c	2011-03-31 13:15:26 UTC (rev 11425)
+++ trunk/mapserver/mapfile.c	2011-03-31 13:27:53 UTC (rev 11426)
@@ -5517,7 +5517,11 @@
   msyylineno = 1; /* start at line 1 (do lines mean anything here?) */
 
   /* If new_mappath is provided then use it, otherwise use the CWD */
-  getcwd(szCWDPath, MS_MAXPATHLEN);
+  if(NULL == getcwd(szCWDPath, MS_MAXPATHLEN)) {
+     msSetError(MS_MISCERR, "getcwd() returned a too long path", "msLoadMapFromString()");
+     msFreeMap(map);
+     msReleaseLock( TLOCK_PARSER );
+  }
   if (new_mappath) {
     mappath = msStrdup(new_mappath);
     map->mappath = msStrdup(msBuildPath(szPath, szCWDPath, mappath));
@@ -5638,7 +5642,12 @@
 
   /* If new_mappath is provided then use it, otherwise use the location */
   /* of the mapfile as the default path */
-  getcwd(szCWDPath, MS_MAXPATHLEN);
+  if(NULL == getcwd(szCWDPath, MS_MAXPATHLEN)) {
+     msSetError(MS_MISCERR, "getcwd() returned a too long path", "msLoadMap()");
+     msFreeMap(map);
+     msReleaseLock( TLOCK_PARSER );
+  }
+  
   if (new_mappath)
     map->mappath = msStrdup(msBuildPath(szPath, szCWDPath, msStrdup(new_mappath)));
   else {



More information about the mapserver-commits mailing list