Skip to content

Commit

Permalink
Check input file state in formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingranade committed Oct 20, 2017
1 parent ba4030b commit 5fb539e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/format/format.cpp
Expand Up @@ -134,6 +134,10 @@ int main( int argc, char *argv[] )
in << std::cin.rdbuf(); in << std::cin.rdbuf();
} else { } else {
std::ifstream fin( filename, std::ios::binary ); std::ifstream fin( filename, std::ios::binary );
if( !fin.good() ) {
std::cout << "Failed to open " << filename << std::endl;
exit( EXIT_FAILURE );
}
in << fin.rdbuf(); in << fin.rdbuf();
fin.close(); fin.close();
} }
Expand Down

0 comments on commit 5fb539e

Please sign in to comment.