summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2017-10-20 07:11:31 (GMT)
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2017-10-20 07:11:31 (GMT)
commit56b81ea7962e678deadcdf12387e68726d0fa262 (patch)
tree8abeddd3b72800106015290fd86df33ccea3af6b /src
parentebf81ac4767823fb209c18ff7e11850cd63deafc (diff)
downloadglog-56b81ea7962e678deadcdf12387e68726d0fa262.zip
glog-56b81ea7962e678deadcdf12387e68726d0fa262.tar.gz
glog-56b81ea7962e678deadcdf12387e68726d0fa262.tar.bz2
Style fixes for consistency
Diffstat (limited to 'src')
-rw-r--r--src/utilities.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/utilities.cc b/src/utilities.cc
index 1a3c7e1..98dc090 100644
--- a/src/utilities.cc
+++ b/src/utilities.cc
@@ -306,21 +306,19 @@ static void MyUserNameInitializer() {
g_my_user_name = user;
} else {
#if defined(HAVE_PWD_H) && defined(HAVE_UNISTD_H)
- uid_t uid;
struct passwd pwd;
- struct passwd*result = NULL;
+ struct passwd* result = NULL;
char buffer[1024] = {'\0'};
- uid = geteuid();
- int pwuid_res = getpwuid_r(uid, &pwd, buffer, sizeof (buffer), &result);
- if(pwuid_res == 0) {
+ uid_t uid = geteuid();
+ int pwuid_res = getpwuid_r(uid, &pwd, buffer, sizeof(buffer), &result);
+ if (pwuid_res == 0) {
g_my_user_name = pwd.pw_name;
- }
- else {
+ } else {
snprintf(buffer, sizeof(buffer), "uid%d", uid);
g_my_user_name = buffer;
}
#endif
- if(g_my_user_name.empty()) {
+ if (g_my_user_name.empty()) {
g_my_user_name = "invalid-user";
}
}