mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Reorder a lock to prevent a potential deadlock in uvars
A call to default_vars_path() takes the environment variable lock while the uvars lock is held. Ensure that doesn't happen by deferring the uvars lock to later in the function.
This commit is contained in:
parent
9f13edbe4a
commit
44b3554a11
1 changed files with 1 additions and 1 deletions
|
@ -505,10 +505,10 @@ bool env_universal_t::move_new_vars_file_into_place(const wcstring &src, const w
|
|||
}
|
||||
|
||||
bool env_universal_t::load() {
|
||||
scoped_lock locker(lock);
|
||||
callback_data_list_t callbacks;
|
||||
const wcstring vars_path =
|
||||
explicit_vars_path.empty() ? default_vars_path() : explicit_vars_path;
|
||||
scoped_lock locker(lock);
|
||||
bool success = load_from_path(vars_path, &callbacks);
|
||||
if (!success && !tried_renaming && errno == ENOENT) {
|
||||
// We failed to load, because the file was not found. Older fish used the hostname only. Try
|
||||
|
|
Loading…
Reference in a new issue