MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / OpenOutputFile

Function OpenOutputFile

src/tw/textreportviewer.cpp:1728–1745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1726}
1727
1728void OpenOutputFile(fixed_basic_ofstream<TCHAR>& out, const TSTRING& strFile) // throw( eTextReportViewer )
1729{
1730 std::string narrowFilename = cStringUtil::TstrToStr(strFile);
1731
1732 // we explicitly create the file so that we control the
1733 // permissions on the new file.
1734 unlink(narrowFilename.c_str());
1735 int fd = open(narrowFilename.c_str(), O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 00600);
1736 if (fd == -1 || close(fd) != 0)
1737 {
1738 throw eTextReportViewerFileOpen(strFile);
1739 }
1740
1741 out.open(narrowFilename.c_str());
1742
1743 if (!out.is_open())
1744 throw eTextReportViewerFileOpen(strFile);
1745}
1746
1747bool SpecEmpty(const cFCOReportSpecIter& ri)
1748{

Callers 1

PrintTextReportMethod · 0.85

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected