diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index cfada0ee1157a9e8acdb612cb7a74281720d3af8..eef12dd2b7579a8a0d2f9fdef1c39446076c42cb 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);