]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
avoid private stdio fields in waitkey
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 4 Nov 2010 13:26:25 +0000 (09:26 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 11 Sep 2013 22:20:05 +0000 (15:20 -0700)
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 <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit aac929badb5e40a59ae77ae69fc43df8f6f376fc)

Change-Id: I2953fe9d27edb30365266b1f4372e5fd18baf06e
Reviewed-on: http://gerrit.openafs.org/9604
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
acinclude.m4
src/butc/lwps.c
src/lwp/waitkey.c

index 1410066189bb9eb9fecc6e3c1231e26d55c35418..a2209043f7dacf8165ea3500074f01a13ee2bc7c 100644 (file)
@@ -1318,6 +1318,7 @@ AC_CHECK_HEADERS([ \
        search.h \
        security/pam_modules.h \
        signal.h \
+       stdio_ext.h \
        stdlib.h \
        string.h \
        strings.h \
index 337849bbc945e92019ebadac1c0b4e1ebe3ed237..377a77fab67cd24bfb47688e0273109b86a8f585 100644 (file)
@@ -24,6 +24,9 @@
 #ifdef HAVE_STDINT_H
 # include <stdint.h>
 #endif
+#ifdef HAVE_STDIO_EXT_H
+#include <stdio_ext.h>
+#endif
 
 #include <afs/procmgmt.h>
 #include <rx/xdr.h>
@@ -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;
index 98e93bcbb82562569e25672396f2a366fc66255d..a84546da0f5efc835e8a260fa944c1d409856284 100644 (file)
@@ -24,6 +24,9 @@
 
 
 #include <stdio.h>
+#ifdef HAVE_STDIO_EXT_H
+#include <stdio_ext.h>
+#endif
 #include <sys/types.h>
 #ifdef AFS_NT40_ENV
 #include <time.h>
@@ -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