Skip to content
Snippets Groups Projects
Commit 3112ce0c authored by Marek Behún's avatar Marek Behún Committed by Simon Glass
Browse files

env: Make return value of env_get_f() behave like sprintf() on success


Currently the env_get_f() function's return value behaves weirdly: it
returns the number of bytes written into `buf`, but whether this is
excluding the terminating NULL-byte or including it depends on whether
there was enough space in `buf`.

Change the function to always return the actual length of the value of
the environment variable (excluding the terminating NULL-byte) on
success. This makes it behave like sprintf().

All users of this function in U-Boot are compatible with this change.

Signed-off-by: default avatarMarek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
parent 6b6e3eeb
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment