From be32b258cb621d3845f4d33931adca8826f1c5b3 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 7 Apr 2005 16:58:02 -0400 Subject: [PATCH] ENH: check return value of GetLongPath --- Source/kwsys/SystemTools.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index a0e5e7e3d..7e925f19f 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2247,7 +2247,11 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p) return path; } char buffer[MAX_PATH+1]; - ::GetLongPathName(path.c_str(), buffer, MAX_PATH+1); + int len = ::GetLongPathName(path.c_str(), buffer, MAX_PATH+1); + if(len == 0 || len > MAX_PATH+1) + { + return path; + } return buffer; #endif }