summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlex Kiernan <alex.kiernan@gmail.com>2019-06-12 15:27:55 +0100
committerTom Rini <trini@konsulko.com>2019-06-20 10:57:08 -0400
commita762311a6cf02396977f59babdf945c226f4404f (patch)
tree01afc22415d38743798362a2c4069b784a452787 /tools
parent656d8da9d2862afd293ae678d37a486d34b76ca2 (diff)
fw_env: Add missing write failure check
If flash_write fails, whilst we propagate this up to our caller, we need to avoid swapping in the new file (if we're on a filesystem) in this case. Fixes: dbc34323796b ("tools: env: Implement atomic replace for filesystem") Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/env/fw_env.c2
1 files changed, 1 insertions, 1 deletions
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);