diff options
Diffstat (limited to 'sysdeps/generic/pty.c')
-rw-r--r-- | sysdeps/generic/pty.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdeps/generic/pty.c b/sysdeps/generic/pty.c index 8df8aba4ba..660602b25a 100644 --- a/sysdeps/generic/pty.c +++ b/sysdeps/generic/pty.c @@ -59,9 +59,12 @@ openpty(amaster, aslave, name, termp, winp) static char line[] = "/dev/ptyXX"; register const char *cp1, *cp2; register int master, slave, ttygid; + size_t buflen = sysconf (_SC_GETGR_R_SIZE_MAX); + char buffer[buflen]; + struct group grbuffer; struct group *gr; - if ((gr = getgrnam("tty")) != NULL) + if (getgrnam_r("tty", &grbuffer, buffer, buflen, &gr) >= 0) ttygid = gr->gr_gid; else ttygid = -1; |