]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - jacinto-ai/caffe-jacinto.git/commitdiff
Update io.cpp
authorYangqing Jia <jiayq84@gmail.com>
Thu, 28 Nov 2013 01:00:00 +0000 (17:00 -0800)
committerYangqing Jia <jiayq84@gmail.com>
Thu, 28 Nov 2013 01:00:00 +0000 (17:00 -0800)
src/caffe/util/io.cpp

index 9e2bdf54b650970b502dba513606036c750751e4..a6b401b93b570cc92298ca52e2a835c7c36ca72f 100644 (file)
@@ -34,6 +34,7 @@ namespace caffe {
 void ReadProtoFromTextFile(const char* filename,
     ::google::protobuf::Message* proto) {
   int fd = open(filename, O_RDONLY);
+  CHECK_NE(fd, -1) << "File not found: " << filename;
   FileInputStream* input = new FileInputStream(fd);
   CHECK(google::protobuf::TextFormat::Parse(input, proto));
   delete input;
@@ -50,6 +51,7 @@ void WriteProtoToTextFile(const Message& proto, const char* filename) {
 
 void ReadProtoFromBinaryFile(const char* filename, Message* proto) {
   int fd = open(filename, O_RDONLY);
+  CHECK_NE(fd, -1) << "File not found: " << filename;
   ZeroCopyInputStream* raw_input = new FileInputStream(fd);
   CodedInputStream* coded_input = new CodedInputStream(raw_input);
   coded_input->SetTotalBytesLimit(536870912, 268435456);