Skip to content

Commit

Permalink
lstmtraining: Handle failed remove syscall (CID 1396166)
Browse files Browse the repository at this point in the history
This fixes a warning from Coverity Scan.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Oct 16, 2018
1 parent d8fdbdb commit edbd07a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/training/lstmtraining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ int main(int argc, char **argv) {
FILE* f = fopen(test_file.c_str(), "wb");
if (f != nullptr) {
fclose(f);
remove(test_file.c_str());
if (remove(test_file.c_str()) != 0) {
tprintf("Error, failed to remove %s: %s\n",
test_file.c_str(), strerror(errno));
return EXIT_FAILURE;
}
} else {
tprintf("Error, model output cannot be written: %s\n", strerror(errno));
return EXIT_FAILURE;
Expand Down

0 comments on commit edbd07a

Please sign in to comment.