Skip to content

Commit

Permalink
Style fixes for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
shinh committed Oct 20, 2017
1 parent 259c809 commit 07781ab
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
Expand Down

0 comments on commit 07781ab

Please sign in to comment.