mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
loader: we can only env_discard() existing variable
While dropping nvpair from nvstore, we also remove the corresponding environment variable. By doing so, we should be careful not to try to unset non-existing variable. Reviewed by: imp MFC after: 2 week Differential revision: https://reviews.freebsd.org/D44083
This commit is contained in:
parent
8db56defa7
commit
1b3f4ccb7d
1 changed files with 6 additions and 2 deletions
|
|
@ -1264,8 +1264,12 @@ zfs_nvstore_unset_impl(void *vdev, const char *name, bool unset_env)
|
|||
rv = zfs_set_bootenv(vdev, spa->spa_bootenv);
|
||||
}
|
||||
|
||||
if (unset_env)
|
||||
env_discard(env_getenv(name));
|
||||
if (unset_env) {
|
||||
struct env_var *ev = env_getenv(name);
|
||||
|
||||
if (ev != NULL)
|
||||
env_discard(ev);
|
||||
}
|
||||
return (rv);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue