mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 02:44:41 +03:00
nvpair: Constify string functions
After addressing coverity complaints involving `nvpair_name()`, the compiler started complaining about dropping const. This lead to a rabbit hole where not only `nvpair_name()` needed to be constified, but also `nvpair_value_string()`, `fnvpair_value_string()` and a few other static functions, plus variable pointers throughout the code. The result became a fairly big change, so it has been split out into its own patch. Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14612
This commit is contained in:
committed by
Brian Behlendorf
parent
50f6934b9c
commit
d1807f168e
@@ -1359,6 +1359,7 @@ vdev_label_write_bootenv(vdev_t *vd, nvlist_t *env)
|
||||
int error;
|
||||
size_t nvsize;
|
||||
char *nvbuf;
|
||||
const char *tmp;
|
||||
|
||||
error = nvlist_size(env, &nvsize, NV_ENCODE_XDR);
|
||||
if (error != 0)
|
||||
@@ -1398,8 +1399,8 @@ vdev_label_write_bootenv(vdev_t *vd, nvlist_t *env)
|
||||
bootenv->vbe_version = fnvlist_lookup_uint64(env, BOOTENV_VERSION);
|
||||
switch (bootenv->vbe_version) {
|
||||
case VB_RAW:
|
||||
if (nvlist_lookup_string(env, GRUB_ENVMAP, &nvbuf) == 0) {
|
||||
(void) strlcpy(bootenv->vbe_bootenv, nvbuf, nvsize);
|
||||
if (nvlist_lookup_string(env, GRUB_ENVMAP, &tmp) == 0) {
|
||||
(void) strlcpy(bootenv->vbe_bootenv, tmp, nvsize);
|
||||
}
|
||||
error = 0;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user