Add $EUID and use it in fish_is_root_user

Fixes #8866
This commit is contained in:
Fabian Homborg
2022-04-15 15:57:57 +02:00
parent 51bbbc2a32
commit 2fa51f1843
3 changed files with 9 additions and 0 deletions

View File

@@ -294,6 +294,7 @@ void env_init(const struct config_paths_t *paths, bool do_uvars, bool default_pa
// so we work around it by resetting $USER.
// TODO: Figure out if that su actually checks if username == "root"(as the man page says) or
// UID == 0.
vars.set_one(L"EUID", ENV_GLOBAL, to_string(static_cast<unsigned long long>(geteuid())));
uid_t uid = getuid();
setup_user(uid == 0);