mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 11:11:13 -03:00
set: Print an error when setting umask to a bad value
Repurpose the ENV_INVALID return value for env_set(), which wasn't currently used by anything. When a bad value is passed for the 'umask' key, return ENV_INVALID to signal this and print a good error message from the `set` builtin. This makes `set umask foo` properly produce an error.
This commit is contained in:
committed by
ridiculousfish
parent
d0c85471b4
commit
9f725bee1f
6
env.cpp
6
env.cpp
@@ -655,10 +655,12 @@ int env_set(const wcstring &key, const wchar_t *val, env_mode_flags_t var_mode)
|
||||
if (!errno && (!*end) && (mask <= 0777) && (mask >= 0))
|
||||
{
|
||||
umask(mask);
|
||||
/* Do not actually create a umask variable, on env_get, it will be calculated dynamically */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* Do not actually create a umask variable, on env_get, it will be calculated dynamically */
|
||||
return 0;
|
||||
|
||||
return ENV_INVALID;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user