Skip to content

Commit edbd07a

Browse files
committed
lstmtraining: Handle failed remove syscall (CID 1396166)
This fixes a warning from Coverity Scan. Signed-off-by: Stefan Weil <[email protected]>
1 parent d8fdbdb commit edbd07a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/training/lstmtraining.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ int main(int argc, char **argv) {
8989
FILE* f = fopen(test_file.c_str(), "wb");
9090
if (f != nullptr) {
9191
fclose(f);
92-
remove(test_file.c_str());
92+
if (remove(test_file.c_str()) != 0) {
93+
tprintf("Error, failed to remove %s: %s\n",
94+
test_file.c_str(), strerror(errno));
95+
return EXIT_FAILURE;
96+
}
9397
} else {
9498
tprintf("Error, model output cannot be written: %s\n", strerror(errno));
9599
return EXIT_FAILURE;

0 commit comments

Comments
 (0)