]> granicus.if.org Git - php/commitdiff
BSD4.1 (possibly others) doesn't support _SC_TTY_NAME_MAX
authorSara Golemon <pollita@php.net>
Fri, 5 Jan 2007 20:01:44 +0000 (20:01 +0000)
committerSara Golemon <pollita@php.net>
Fri, 5 Jan 2007 20:01:44 +0000 (20:01 +0000)
ext/posix/posix.c

index 7809e48bf5028144fffc1882853ed53f18495423..e9bfd1da661ebec838c27e3a3478e5db1746fb20 100644 (file)
@@ -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)) {