From: Sara Golemon Date: Fri, 5 Jan 2007 20:01:44 +0000 (+0000) Subject: BSD4.1 (possibly others) doesn't support _SC_TTY_NAME_MAX X-Git-Tag: RELEASE_1_0_0RC1~387 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=925cbe4cfec3d4ec223dff3278b9c4e848550111;p=php BSD4.1 (possibly others) doesn't support _SC_TTY_NAME_MAX --- diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 7809e48bf5..e9bfd1da66 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)) {