diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/system/user.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/user.cpp')
-rw-r--r-- | util/system/user.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/util/system/user.cpp b/util/system/user.cpp index 83e89ea0a8..bdbc9e54dc 100644 --- a/util/system/user.cpp +++ b/util/system/user.cpp @@ -6,19 +6,19 @@ #include <util/generic/yexception.h> #ifdef _win_ - #include "winint.h" + #include "winint.h" #else - #include <errno.h> - #include <pwd.h> - #include <unistd.h> + #include <errno.h> + #include <pwd.h> + #include <unistd.h> #endif TString GetUsername() { for (const auto& var : {"LOGNAME", "USER", "LNAME", "USERNAME"}) { TString val = GetEnv(var); - if (val) { + if (val) { return val; - } + } } TTempBuf nameBuf; @@ -34,15 +34,15 @@ TString GetUsername() { } else { return TString(nameBuf.Data(), (size_t)(len - 1)); } -#elif defined(_bionic_) - const passwd* pwd = getpwuid(geteuid()); - - if (pwd) { +#elif defined(_bionic_) + const passwd* pwd = getpwuid(geteuid()); + + if (pwd) { return TString(pwd->pw_name); - } - + } + ythrow TSystemError() << TStringBuf(" getpwuid failed"); -#else +#else passwd pwd; passwd* tmpPwd; int err = getpwuid_r(geteuid(), &pwd, nameBuf.Data(), nameBuf.Size(), &tmpPwd); |