Skip to content

Commit

Permalink
Merge pull request #350 from TheModMaker/fixIosSim
Browse files Browse the repository at this point in the history
Allow getpwuid_r to return missing entry.
  • Loading branch information
sergiud authored Oct 31, 2019
2 parents 1a4c47a + a606c31 commit 242130d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Fumitoshi Ukai <[email protected]>
Guillaume Dumont <[email protected]>
Håkan L. S. Younes <[email protected]>
Ivan Penkov <[email protected]>
Jacob Trimble <[email protected]>
Jim Ray <[email protected]>
Michael Tanner <[email protected]>
MiniLight <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion src/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static void MyUserNameInitializer() {
char buffer[1024] = {'\0'};
uid_t uid = geteuid();
int pwuid_res = getpwuid_r(uid, &pwd, buffer, sizeof(buffer), &result);
if (pwuid_res == 0) {
if (pwuid_res == 0 && result) {
g_my_user_name = pwd.pw_name;
} else {
snprintf(buffer, sizeof(buffer), "uid%d", uid);
Expand Down

0 comments on commit 242130d

Please sign in to comment.