view m4/jm-glibc-io.m4n @ 3398:1beac6d79e51

Merge 'exclude' changes from tar 1.13.22. This fixes one or two unlikely storage allocation overflow bugs, but doesn't change user-visible behavior otherwise. (bool): Declare, perhaps by including stdbool.h. (<sys/types.h>): Include only if HAVE_SYS_TYPES_H. (<stdlib.h>, <string.h>, <strings.h>, <inttypes.h>, <stdint.h>): Include if available. (<xalloc.h>): Include (SIZE_MAX): Define if <stdint.h> or <inttypes.h> doesn't. (verify): New macro. Use it to verify that EXCLUDE macros do not collide with FNM macros. (struct patopts): New struct. (struct exclude): Use it, as exclude patterns now come with options. (new_exclude): Support above changes. (new_exclude, add_exclude_file): Initial size must now be a power of two to simplify overflow checking. (free_exclude, fnmatch_no_wildcards): New function. (excluded_filename): No longer requires options arg, as the options are determined by add_exclude. Now returns bool, not int. (excluded_filename, add_exclude): Add support for the fancy new exclusion options. (add_exclude, add_exclude_file): Now takes int options arg. Check for arithmetic overflow when computing sizes. (add_exclude_file): xrealloc might modify errno, so don't realloc until after errno might be used.
author Jim Meyering <jim@meyering.net>
date Fri, 31 Aug 2001 06:33:42 +0000
parents 0477051f57eb
children d6e42ed6ec16
line wrap: on
line source

#serial 6 -*- autoconf -*-

dnl From Jim Meyering.
dnl
dnl See if the glibc *_unlocked I/O macros are available.
dnl Use only those *_unlocked macros that are declared.
dnl

AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
  [
    # Kludge (not executed) to make autoheader do the right thing.
    if test a = b; then
      AC_CHECK_DECLS([@comma_separated@])
      AC_CHECK_FUNCS(@space_separated@)
    fi

    io_functions='@space_separated@'

    for jm_io_func in $io_functions; do
      # Check for the existence of each function only if it is declared.
      # Otherwise, we'd get the Solaris5.5.1 functions that are not
      # declared, and that have been removed from Solaris5.6.  The resulting
      # 5.5.1 binaries would not run on 5.6 due to shared library differences.
      AC_CHECK_DECLS([$jm_io_func],
		     jm_declared=yes,
		     jm_declared=no,
		     [#include <stdio.h>])
      if test $jm_declared = yes; then
        AC_CHECK_FUNCS($jm_io_func)
      fi
    done
  ]
)