From 9e773854c8cd24e526a6beed6bee74313a7fd47b Mon Sep 17 00:00:00 2001 From: Douglas Mencken Date: Sun, 7 Sep 2014 05:56:50 -0400 Subject: l10ntools/source/export.cxx: add sanity check to aOutput.mSimple MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I05074760f189dfc00ce14ec33002609a56797a6d Reviewed-on: https://gerrit.libreoffice.org/11321 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- l10ntools/source/export.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'l10ntools') diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index efd336d659b1..49805ccc83c0 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -233,6 +233,11 @@ Export::Export( { aOutput.mSimple = new std::ofstream(); aOutput.mSimple->open(rOutput.getStr(), std::ios_base::out | std::ios_base::trunc); + if (!aOutput.mSimple->is_open()) + { + std::fprintf(stderr, "ERROR : Can't open file %s\n", rOutput.getStr()); + std::exit(EXIT_FAILURE); + } if ( bUTF8BOM ) WriteUTF8ByteOrderMarkToOutput(); } -- cgit