Code around a bug in getgrgid_r which I've just noticed exists in some

versions of glibc but not others. It fails to return a value through its last
parameter.  getpwuid_r doesn't seem to have the same bug, but avoid its last
parameter too as a bit of defensive programming.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49010 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell
2007-10-01 21:25:08 +00:00
parent 85aabfa200
commit 52c5891fa3

View File

@@ -360,7 +360,7 @@ static wxString wxTarUserName(int uid)
struct passwd pw;
if (getpwuid_r(uid, &pw, buf.data(), bufsize, &ppw) == 0)
return wxString(ppw->pw_name, wxConvLibc);
return wxString(pw.pw_name, wxConvLibc);
#else
if ((ppw = getpwuid(uid)) != NULL)
return wxString(ppw->pw_name, wxConvLibc);
@@ -382,7 +382,7 @@ static wxString wxTarGroupName(int gid)
struct group gr;
if (getgrgid_r(gid, &gr, buf.data(), bufsize, &pgr) == 0)
return wxString(pgr->gr_name, wxConvLibc);
return wxString(gr.gr_name, wxConvLibc);
#else
if ((pgr = getgrgid(gid)) != NULL)
return wxString(pgr->gr_name, wxConvLibc);