From: Michael Meffie Date: Thu, 4 Nov 2010 13:26:25 +0000 (-0400) Subject: avoid private stdio fields in waitkey X-Git-Tag: upstream/1.6.6_pre2^2~78 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=0b591f452e62032fe9f70610b1a671d620e5d724;p=packages%2Fo%2Fopenafs.git avoid private stdio fields in waitkey Use the stdio_ext functions provided by solaris and glibc instead of directly accessing private stdio FILE structure members. This is needed for 64-bit solaris builds and is more portable in general since the FILE structure is meant to be opaque. This is a backport of commit aac929badb5e40a59ae77ae69fc43df8f6f376fc, without the changes to remove duplicate code. Reviewed-on: http://gerrit.openafs.org/3257 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit aac929badb5e40a59ae77ae69fc43df8f6f376fc) Change-Id: I2953fe9d27edb30365266b1f4372e5fd18baf06e Reviewed-on: http://gerrit.openafs.org/9604 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand --- diff --git a/acinclude.m4 b/acinclude.m4 index 141006618..a2209043f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1318,6 +1318,7 @@ AC_CHECK_HEADERS([ \ search.h \ security/pam_modules.h \ signal.h \ + stdio_ext.h \ stdlib.h \ string.h \ strings.h \ diff --git a/src/butc/lwps.c b/src/butc/lwps.c index 337849bbc..377a77fab 100644 --- a/src/butc/lwps.c +++ b/src/butc/lwps.c @@ -24,6 +24,9 @@ #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STDIO_EXT_H +#include +#endif #include #include @@ -387,6 +390,9 @@ WaitForKeystroke(int seconds) #ifdef AFS_LINUX20_ENV if (stdin->_IO_read_ptr < stdin->_IO_read_end) return 1; +#elif defined(HAVE_STDIO_EXT_H) + if (__fbufsize(stdin) > 0) + return 1; #else if (stdin->_cnt > 0) return 1; diff --git a/src/lwp/waitkey.c b/src/lwp/waitkey.c index 98e93bcbb..a84546da0 100644 --- a/src/lwp/waitkey.c +++ b/src/lwp/waitkey.c @@ -24,6 +24,9 @@ #include +#ifdef HAVE_STDIO_EXT_H +#include +#endif #include #ifdef AFS_NT40_ENV #include @@ -181,8 +184,13 @@ LWP_WaitForKeystroke(int seconds) return 1; #endif #else +#if defined(HAVE_STDIO_EXT_H) + if (__fbufsize(stdin) > 0) + return 1; +#else /* HAVE_STDIO_EXT_H */ if (stdin->_cnt > 0) return 1; +#endif /* HAVE_STDIO_EXT_H */ #endif #endif