mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 23:22:53 +08: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
@ -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…
x
Reference in New Issue
Block a user