Commit a762311a6cf02396977f59babdf945c226f4404f

Authored by Alex Kiernan
Committed by Tom Rini
1 parent 656d8da9d2

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -1317,7 +1317,7 @@
1317 1317 rc = -1;
1318 1318 }
1319 1319  
1320   - if (target_temp) {
  1320 + if (rc >= 0 && target_temp) {
1321 1321 int dir_fd;
1322 1322  
1323 1323 dir_fd = open(dname, O_DIRECTORY | O_RDONLY);