diff options
Diffstat (limited to 'tools/lldb-mi/MIUtilFileStd.cpp')
-rw-r--r-- | tools/lldb-mi/MIUtilFileStd.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/tools/lldb-mi/MIUtilFileStd.cpp b/tools/lldb-mi/MIUtilFileStd.cpp index abf0ef407d3b..2d8a05985e59 100644 --- a/tools/lldb-mi/MIUtilFileStd.cpp +++ b/tools/lldb-mi/MIUtilFileStd.cpp @@ -1,9 +1,8 @@ //===-- MIUtilFileStd.cpp ---------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,9 +18,9 @@ #include "lldb/Host/FileSystem.h" #include "llvm/Support/ConvertUTF.h" +#include "llvm/Support/Errno.h" //++ -//------------------------------------------------------------------------------------ // Details: CMIUtilFileStd constructor. // Type: Method. // Args: None. @@ -42,7 +41,6 @@ CMIUtilFileStd::CMIUtilFileStd() } //++ -//------------------------------------------------------------------------------------ // Details: CMIUtilFileStd destructor. // Type: Method. // Args: None. @@ -52,7 +50,6 @@ CMIUtilFileStd::CMIUtilFileStd() CMIUtilFileStd::~CMIUtilFileStd() { Close(); } //++ -//------------------------------------------------------------------------------------ // Details: Open file for writing. On the first call to this function after // *this object // is created the file is either created or replace, from then on open @@ -84,7 +81,8 @@ bool CMIUtilFileStd::CreateWrite(const CMIUtilString &vFileNamePath, #if !defined(_MSC_VER) // Open with 'write' and 'binary' mode - m_pFileHandle = ::fopen(vFileNamePath.c_str(), "wb"); + m_pFileHandle = llvm::sys::RetryAfterSignal(nullptr, ::fopen, + vFileNamePath.c_str(), "wb"); #else // Open a file with exclusive write and shared read permissions std::wstring path; @@ -110,7 +108,6 @@ bool CMIUtilFileStd::CreateWrite(const CMIUtilString &vFileNamePath, } //++ -//------------------------------------------------------------------------------------ // Details: Write data to existing opened file. // Type: Method. // Args: vData - (R) Text data. @@ -148,7 +145,6 @@ bool CMIUtilFileStd::Write(const CMIUtilString &vData) { } //++ -//------------------------------------------------------------------------------------ // Details: Write data to existing opened file. // Type: Method. // Args: vData - (R) Text data. @@ -185,7 +181,6 @@ bool CMIUtilFileStd::Write(const char *vpData, const MIuint vCharCnt) { } //++ -//------------------------------------------------------------------------------------ // Details: Close existing opened file. Note Close() must must an open! // Type: Method. // Args: None. @@ -203,7 +198,6 @@ void CMIUtilFileStd::Close() { } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve state of whether the file is ok. // Type: Method. // Args: None. @@ -214,7 +208,6 @@ void CMIUtilFileStd::Close() { bool CMIUtilFileStd::IsOk() const { return !m_bFileError; } //++ -//------------------------------------------------------------------------------------ // Details: Status on a file existing already. // Type: Method. // Args: vFileNamePath. @@ -227,7 +220,8 @@ bool CMIUtilFileStd::IsFileExist(const CMIUtilString &vFileNamePath) const { return false; FILE *pTmp = nullptr; - pTmp = ::fopen(vFileNamePath.c_str(), "wb"); + pTmp = llvm::sys::RetryAfterSignal(nullptr, ::fopen, + vFileNamePath.c_str(), "wb"); if (pTmp != nullptr) { ::fclose(pTmp); return true; @@ -237,7 +231,6 @@ bool CMIUtilFileStd::IsFileExist(const CMIUtilString &vFileNamePath) const { } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve the file current carriage line return characters used. // Type: Method. // Args: None. @@ -249,7 +242,6 @@ const CMIUtilString &CMIUtilFileStd::GetLineReturn() const { } //++ -//------------------------------------------------------------------------------------ // Details: Given a file name directory path, strip off the filename and return // the path. // It look for either backslash or forward slash. @@ -273,7 +265,6 @@ CMIUtilFileStd::StripOffFileName(const CMIUtilString &vDirectoryPath) { } //++ -//------------------------------------------------------------------------------------ // Details: Return either backslash or forward slash appropriate to the OS this // application // is running on. |