Module Name: src Committed By: christos Date: Fri Dec 4 01:43:58 UTC 2015
Modified Files: src/external/bsd/atf/dist/atf-sh: atf-check.cpp Log Message: fix the open error messages to include the right file and strerror To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/bsd/atf/dist/atf-sh/atf-check.cpp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/atf/dist/atf-sh/atf-check.cpp diff -u src/external/bsd/atf/dist/atf-sh/atf-check.cpp:1.9 src/external/bsd/atf/dist/atf-sh/atf-check.cpp:1.10 --- src/external/bsd/atf/dist/atf-sh/atf-check.cpp:1.9 Sat Feb 8 14:13:44 2014 +++ src/external/bsd/atf/dist/atf-sh/atf-check.cpp Thu Dec 3 20:43:58 2015 @@ -359,11 +359,20 @@ execute_with_shell(char* const* argv) static void +open_error(const atf::fs::path& path) +{ + throw std::runtime_error("Failed to open " + path.str() + " " + + ::strerror(errno)); +} + + +static +void cat_file(const atf::fs::path& path) { std::ifstream stream(path.c_str()); if (!stream) - throw std::runtime_error("Failed to open " + path.str()); + open_error(path); stream >> std::noskipws; std::istream_iterator< char > begin(stream), end; @@ -379,7 +388,7 @@ grep_file(const atf::fs::path& path, con { std::ifstream stream(path.c_str()); if (!stream) - throw std::runtime_error("Failed to open " + path.str()); + open_error(path); bool found = false; @@ -410,11 +419,11 @@ compare_files(const atf::fs::path& p1, c std::ifstream f1(p1.c_str()); if (!f1) - throw std::runtime_error("Failed to open " + p1.str()); + open_error(p1); std::ifstream f2(p2.c_str()); if (!f2) - throw std::runtime_error("Failed to open " + p1.str()); + open_error(p2); for (;;) { char buf1[512], buf2[512];