[GRASS-SVN] r67078 - grass/branches/releasebranch_7_0/raster/r.external
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Dec 12 04:51:32 PST 2015
Author: martinl
Date: 2015-12-12 04:51:32 -0800 (Sat, 12 Dec 2015)
New Revision: 67078
Modified:
grass/branches/releasebranch_7_0/raster/r.external/main.c
Log:
r.external: use CPLGetCurrentDir() instead of getcwd() - mingw/msvc issue
(merge r67049 from trunk)
Modified: grass/branches/releasebranch_7_0/raster/r.external/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.external/main.c 2015-12-12 12:49:59 UTC (rev 67077)
+++ grass/branches/releasebranch_7_0/raster/r.external/main.c 2015-12-12 12:51:32 UTC (rev 67078)
@@ -8,7 +8,7 @@
*
* PURPOSE: Link raster map into GRASS utilizing the GDAL library.
*
- * COPYRIGHT: (C) 2008, 2010-2011 by Glynn Clements and the GRASS Development Team
+ * COPYRIGHT: (C) 2008-2015 by Glynn Clements and the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <math.h>
#include <string.h>
+
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/imagery.h>
@@ -27,6 +28,7 @@
#include <gdal.h>
#include <ogr_srs_api.h>
+#include <cpl_conv.h>
#include "proto.h"
@@ -148,11 +150,14 @@
parm.input->key, parm.source->key);
if (input && !G_is_absolute_path(input)) {
- char path[GPATH_MAX];
- getcwd(path, sizeof(path));
- strcat(path, "/");
- strcat(path, input);
+ char path[GPATH_MAX], *cwd;
+ cwd = CPLGetCurrentDir();
+ if (!cwd)
+ G_fatal_error(_("Unable to get current working directory"));
+
+ G_snprintf(path, GPATH_MAX, "%s%c%s", cwd, HOST_DIRSEP, input);
input = G_store(path);
+ CPLFree(cwd);
}
if (!input)
More information about the grass-commit
mailing list