A few bugs dating back to the original bootenv support:
- delete_pair() freed an uninitialized nvlist if it couldn't fetch the bootenv, e.g., with a nonexistent pool.
- A missing else meant that "yes" and "no" were always rejected for DATA_TYPE_BOOLEAN_VALUE; only "true", "false" and numbers worked.
- With -p, the result of printing the bootenv replaced the result of setting or deleting a key, so a failed set or delete exited 0.
- errno was never cleared before strto*(), so a stale errno left behind by libzfs could make a valid numeric value fail.
Values for the narrower integer types are still silently truncated
(e.g., 300 for DATA_TYPE_UINT8 sets 44). Rejecting them would also
reject values like -1 for the unsigned types that scripts may rely on,
so I'm punting for now.
Reported by: llm-postcr
Fixes: e307eb94ae52 ("loader: zfs should support [...]")
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.