Skip to content

Fix file reading/writing when the environment is in EEPROM

Stefano babic requested to merge github/fork/AdrianBunk/master into master

Created by: AdrianBunk

Trying to use fw_printenv/fw_setenv with /sys/bus/i2c/devices/0-0050/eeprom always fails for me:

$ fw_printenv Cannot read environment, using default Cannot read default environment from file $

The problem is that fileread() and filewrite() in src/uboot_env.c read/write once, and callers treat it as error if they did read/write fewer bytes than requested.

In C it is not an error if fewer bytes get read/written than requested, the caller is supposed to retry with the remaining bytes until everything is done or an error occurs.

Merge request reports