1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

Remove PATH_MAX sized stack allocation from virFileOpenTtyAt

This commit is contained in:
Matthias Bolte 2011-04-03 11:21:27 +02:00
parent f044376530
commit 25f85e4938

View File

@ -1902,14 +1902,13 @@ int virFileOpenTtyAt(const char *ptmx,
}
if (ttyName) {
char tempTtyName[PATH_MAX];
if (ptsname_r(*ttymaster, tempTtyName, sizeof(tempTtyName)) < 0)
goto cleanup;
if ((*ttyName = strdup(tempTtyName)) == NULL) {
if (VIR_ALLOC_N(*ttyName, PATH_MAX) < 0) {
errno = ENOMEM;
goto cleanup;
}
if (ptsname_r(*ttymaster, *ttyName, PATH_MAX) < 0)
goto cleanup;
}
rc = 0;