diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index cfada0ee11..eef12dd2b7 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1317,7 +1317,7 @@ static int flash_io_write(int fd_current) rc = -1; } - if (target_temp) { + if (rc >= 0 && target_temp) { int dir_fd; dir_fd = open(dname, O_DIRECTORY | O_RDONLY);