bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fpurge.c, freadahead.c, freading.c make wrong assumption


From: Roger Cornelius
Subject: fpurge.c, freadahead.c, freading.c make wrong assumption
Date: Thu, 13 Mar 2008 15:24:15 -0400
User-agent: Mutt/1.5.17 (2007-11-01)

findutils v4.3.9

When _IOERR is defined, fpurge.c, freadahead.c, and freading.c wrongly
assume FILE struct members are named with a single leading "_"
character.  E.g., this section of code at line 95 of fpurge.c:

# elif defined _IOERR               /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw 
*/
  fp->_ptr = fp->_base;
  if (fp->_ptr != NULL)
    fp->_cnt = 0;
  return 0;
# elif defined __UCLIBC__           /* uClibc */


In the case of SCO OpenServer and Unixware, this assumption is wrong.
On these OS'es, FILE struct members are named using two leading "_"
characters.  From /usr/include/stdio.h on SCO OpenServer 6:

typedef struct _FILE_
{
        int             __cnt;          /* num. avail. characters in buffer */
        unsigned char   *__ptr;         /* next character from/to here */
        unsigned char   *__base;        /* the buffer (not really) */
        unsigned char   __flag;         /* the state of the stream */
        unsigned char   __file;         /* file descriptor (not necessarily) */
        unsigned char   __buf[2];       /* micro buffer as a fall-back */
} FILE;

This issue is already taken into account in some circumstances.  
Please see files configure and gnulib/m4/fpending.m4 and search for
"SCO, Unixware".

This has been present going back to v4.2.28 I believe.
-- 
Roger Cornelius        address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]