summaryrefslogtreecommitdiffstats
path: root/SystemTools.cxx
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2017-01-16 13:53:56 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-16 19:06:28 (GMT)
commit219c7bdcb16cd1dfe2e72befa4334c5b8147e1d7 (patch)
treeaa42dc456d8441fe824c444feb3b114aee960f8c /SystemTools.cxx
parenta9ea66bd66db0f0ad9b0b59d617739ad6a04cebf (diff)
downloadCMake-219c7bdcb16cd1dfe2e72befa4334c5b8147e1d7.zip
CMake-219c7bdcb16cd1dfe2e72befa4334c5b8147e1d7.tar.gz
CMake-219c7bdcb16cd1dfe2e72befa4334c5b8147e1d7.tar.bz2
KWSys 2017-01-16 (a423d829)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit a423d82989a4b89fa7d17f3dd5215684e902208e (master). Upstream Shortlog ----------------- Ben Boeckel (1): 45db0937 SystemTools: use PathExists where appropriate Brad King (1): e08eee61 SystemTools: Fix conversion warning in test case Eric Berge (1): 687fcd79 Add -lsocket for libcmsys.a build on SunOS Gregor Jasny (1): 0541ce21 SystemTools: Fix off-by-one in GetLineFromStream with size limit
Diffstat (limited to 'SystemTools.cxx')
-rw-r--r--SystemTools.cxx11
1 files changed, 4 insertions, 7 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx
index b018a43..97dd4ae 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -763,7 +763,7 @@ bool SystemTools::MakeDirectory(const char* path)
bool SystemTools::MakeDirectory(const std::string& path)
{
- if (SystemTools::FileExists(path)) {
+ if (SystemTools::PathExists(path)) {
return SystemTools::FileIsDirectory(path);
}
if (path.empty()) {
@@ -1280,7 +1280,7 @@ bool SystemTools::PathCygwinToWin32(const char* path, char* win32_path)
bool SystemTools::Touch(const std::string& filename, bool create)
{
- if (!SystemTools::FileExists(filename)) {
+ if (!SystemTools::PathExists(filename)) {
if (create) {
FILE* file = Fopen(filename, "a+b");
if (file) {
@@ -4289,7 +4289,7 @@ bool SystemTools::GetLineFromStream(std::istream& is, std::string& line,
// if we read too much then truncate the buffer
if (leftToRead > 0) {
if (static_cast<long>(length) > leftToRead) {
- buffer[leftToRead - 1] = 0;
+ buffer[leftToRead] = 0;
leftToRead = 0;
} else {
leftToRead -= static_cast<long>(length);
@@ -4389,10 +4389,7 @@ bool SystemTools::SetPermissions(const char* file, mode_t mode,
bool SystemTools::SetPermissions(const std::string& file, mode_t mode,
bool honor_umask)
{
- // TEMPORARY / TODO: After FileExists calls lstat() instead of
- // access(), change this call to FileExists instead of
- // TestFileAccess so that we don't follow symlinks.
- if (!SystemTools::TestFileAccess(file, TEST_FILE_OK)) {
+ if (!SystemTools::PathExists(file)) {
return false;
}
if (honor_umask) {