env: Correct type

We'd be comparing "int" and "mode_t", and "mode_t" might be unsigned.

Found via GCC warning.
This commit is contained in:
Fabian Homborg 2019-05-29 20:24:40 +02:00
parent e895cef245
commit a5b633d3a5

View file

@ -658,7 +658,7 @@ maybe_t<env_var_t> env_scoped_impl_t::try_get_computed(const wcstring &key) cons
// note umask() is an absurd API: you call it to set the value and it returns the old // note umask() is an absurd API: you call it to set the value and it returns the old
// value. Thus we have to call it twice, to reset the value. The env_lock protects // value. Thus we have to call it twice, to reset the value. The env_lock protects
// against races. Guess what the umask is; if we guess right we don't need to reset it. // against races. Guess what the umask is; if we guess right we don't need to reset it.
int guess = 022; mode_t guess = 022;
mode_t res = umask(guess); mode_t res = umask(guess);
if (res != guess) umask(res); if (res != guess) umask(res);
return env_var_t(L"umask", format_string(L"0%0.3o", res)); return env_var_t(L"umask", format_string(L"0%0.3o", res));