Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mgiza.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Vermeulen <jtv@precisiontranslationtools.com>2015-05-26 12:31:39 +0300
committerJeroen Vermeulen <jtv@precisiontranslationtools.com>2015-05-26 12:31:39 +0300
commitbb04cf9032c093e72b53011ea668ee8c613cb901 (patch)
treea3e817eb9568250b7b20e458b583ae7f243386a2
parent043963da36307f91a2f69b8babcafca09e813aa1 (diff)
Check getcwd() for failure.
Silences a compile warning.
-rw-r--r--mgizapp/src/Parameter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/mgizapp/src/Parameter.cpp b/mgizapp/src/Parameter.cpp
index ff8c400..51ae776 100644
--- a/mgizapp/src/Parameter.cpp
+++ b/mgizapp/src/Parameter.cpp
@@ -28,6 +28,7 @@ USA.
#include <direct.h>
#define getcwd _getcwd
#endif
+#include <stdexcept>
#include <strstream>
@@ -47,7 +48,9 @@ bool writeParameters(ofstream&of,const ParSet&parset,int level)
of << (*i)->getString() << " ";
if( absolutePathNames&&(*i)->isFilename()&&s.length()&&s[0]!='/' ) {
char path[1024];
- getcwd(path,1024);
+ if (getcwd(path, 1024) == NULL)
+ throw std::runtime_error(
+ "Could not get current working directory.");
of << path << '/';
}
if( ParameterPathPrefix.length()&&(*i)->isFilename()&&s.length()&&s[0]!='/' )