From 925cbe4cfec3d4ec223dff3278b9c4e848550111 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Fri, 5 Jan 2007 20:01:44 +0000 Subject: [PATCH] BSD4.1 (possibly others) doesn't support _SC_TTY_NAME_MAX --- ext/posix/posix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 7809e48bf50..e9bfd1da661 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -575,7 +575,12 @@ PHP_FUNCTION(posix_ttyname) fd = Z_LVAL_PP(z_fd); } #if HAVE_TTYNAME_R +#ifdef _SC_TTY_NAME_MAX buflen = sysconf(_SC_TTY_NAME_MAX); +#else + /* Arbitrary buffer size for systems which don't extrospect their tty name lengths, way overkill */ + buflen = 64; +#endif p = emalloc(buflen); if (ttyname_r(fd, p, buflen)) {