Commit graph

40 commits

Author SHA1 Message Date
Paul Eggert 581c785bf3 Update copyright dates with scripts/update-copyrights
I used these shell commands:

../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")

and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 7061 files FOO.

I then removed trailing white space from math/tgmath.h,
support/tst-support-open-dev-null-range.c, and
sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following
obscure pre-commit check failure diagnostics from Savannah.  I don't
know why I run into these diagnostics whereas others evidently do not.

remote: *** 912-#endif
remote: *** 913:
remote: *** 914-
remote: *** error: lines with trailing whitespace found
...
remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
2022-01-01 11:40:24 -08:00
Paul Eggert 2b778ceb40 Update copyright dates with scripts/update-copyrights
I used these shell commands:

../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")

and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 6694 files FOO.
I then removed trailing white space from benchtests/bench-pthread-locks.c
and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this
diagnostic from Savannah:
remote: *** pre-commit check failed ...
remote: *** error: lines with trailing whitespace found
remote: error: hook declined to update refs/heads/master
2021-01-02 12:17:34 -08:00
Joseph Myers d614a75396 Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
Paul Eggert 5a82c74822 Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:

sed -ri '
  s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
  s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
  $(find $(git ls-files) -prune -type f \
      ! -name '*.po' \
      ! -name 'ChangeLog*' \
      ! -path COPYING ! -path COPYING.LIB \
      ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
      ! -path manual/texinfo.tex ! -path scripts/config.guess \
      ! -path scripts/config.sub ! -path scripts/install-sh \
      ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
      ! -path INSTALL ! -path  locale/programs/charmap-kw.h \
      ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
      ! '(' -name configure \
            -execdir test -f configure.ac -o -f configure.in ';' ')' \
      ! '(' -name preconfigure \
            -execdir test -f preconfigure.ac ';' ')' \
      -print)

and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:

  chmod a+x sysdeps/unix/sysv/linux/riscv/configure
  # Omit irrelevant whitespace and comment-only changes,
  # perhaps from a slightly-different Autoconf version.
  git checkout -f \
    sysdeps/csky/configure \
    sysdeps/hppa/configure \
    sysdeps/riscv/configure \
    sysdeps/unix/sysv/linux/csky/configure
  # Omit changes that caused a pre-commit check to fail like this:
  # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
  git checkout -f \
    sysdeps/powerpc/powerpc64/ppc-mcount.S \
    sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
  # Omit change that caused a pre-commit check to fail like this:
  # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
  git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 02:43:31 -07:00
Joseph Myers 04277e02d7 Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2019-01-01 00:11:28 +00:00
Zack Weinberg 9964a14579 Mechanically remove _IO_ name aliases for types and constants.
This patch mechanically removes all remaining uses, and the
definitions, of the following libio name aliases:

 name                         replaced with
 ----                         -------------
 _IO_FILE                     FILE
 _IO_fpos_t                   __fpos_t
 _IO_fpos64_t                 __fpos64_t
 _IO_size_t                   size_t
 _IO_ssize_t                  ssize_t or __ssize_t
 _IO_off_t                    off_t
 _IO_off64_t                  off64_t
 _IO_pid_t                    pid_t
 _IO_uid_t                    uid_t
 _IO_wint_t                   wint_t
 _IO_va_list                  va_list or __gnuc_va_list
 _IO_BUFSIZ                   BUFSIZ
 _IO_cookie_io_functions_t    cookie_io_functions_t
 __io_read_fn                 cookie_read_function_t
 __io_write_fn                cookie_write_function_t
 __io_seek_fn                 cookie_seek_function_t
 __io_close_fn                cookie_close_function_t

I used __fpos_t and __fpos64_t instead of fpos_t and fpos64_t because
the definitions of fpos_t and fpos64_t depend on the largefile mode.
I used __ssize_t and __gnuc_va_list in a handful of headers where
namespace cleanliness might be relevant even though they're
internal-use-only.  In all other cases, I used the public-namespace
name.

There are a tiny handful of places where I left a use of 'struct _IO_FILE'
alone, because it was being used together with 'struct _IO_FILE_plus'
or 'struct _IO_FILE_complete' in the same arithmetic expression.

Because this patch was almost entirely done with search and replace, I
may have introduced indentation botches.  I did proofread the diff,
but I may have missed something.

The ChangeLog below calls out all of the places where this was not a
pure search-and-replace change.

Installed stripped libraries and executables are unchanged by this patch,
except that some assertions in vfscanf.c change line numbers.

	* libio/libio.h (_IO_FILE): Delete; all uses changed to FILE.
	(_IO_fpos_t): Delete; all uses changed to __fpos_t.
	(_IO_fpos64_t): Delete; all uses changed to __fpos64_t.
	(_IO_size_t): Delete; all uses changed to size_t.
	(_IO_ssize_t): Delete; all uses changed to ssize_t or __ssize_t.
	(_IO_off_t): Delete; all uses changed to off_t.
	(_IO_off64_t): Delete; all uses changed to off64_t.
	(_IO_pid_t): Delete; all uses changed to pid_t.
	(_IO_uid_t): Delete; all uses changed to uid_t.
	(_IO_wint_t): Delete; all uses changed to wint_t.
	(_IO_va_list): Delete; all uses changed to va_list or __gnuc_va_list.
	(_IO_BUFSIZ): Delete; all uses changed to BUFSIZ.
	(_IO_cookie_io_functions_t): Delete; all uses changed to
	cookie_io_functions_t.
	(__io_read_fn): Delete; all uses changed to cookie_read_function_t.
	(__io_write_fn): Delete; all uses changed to cookie_write_function_t.
	(__io_seek_fn): Delete; all uses changed to cookie_seek_function_t.
	(__io_close_fn): Delete: all uses changed to cookie_close_function_t.

	* libio/iofopncook.c: Remove unnecessary forward declarations.
	* libio/iolibio.h: Correct outdated commentary.
	* malloc/malloc.c (__malloc_stats): Remove unnecessary casts.
	* stdio-common/fxprintf.c (__fxprintf_nocancel):
	Remove unnecessary casts.
	* stdio-common/getline.c: Use _IO_getdelim directly.
	Don't redefine ssize_t.
	* stdio-common/printf_fp.c, stdio_common/printf_fphex.c
	* stdio-common/printf_size.c: Don't redefine size_t or FILE.
	Remove outdated comments.
	* stdio-common/vfscanf.c: Don't redefine va_list.
2018-02-21 14:11:05 -05:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
Zack Weinberg 48a8f83281 Deprecate external use of libio.h and _G_config.h.
libio.h was originally the header for a set of supported GNU
extensions, but they have not been maintained as such in many years,
they are now standing in the way of improvements to stdio, and we
don't think there are any remaining external users.  _G_config.h was
never intended for public use, but predates the bits convention.
Move both of these headers into the bits directory and provide stubs
at top level which issue deprecation warnings.

The contents of (bits/)libio.h and (bits/)_G_config.h are still
exposed to external software via stdio.h; changing that requires more
complex surgery than I have time to attempt right now.

	* libio/libio.h, libio/_G_config.h: New stub headers which issue a
	deprecation warning and then include <bits/libio.h>, <bits/_G_config.h>
	respectively.
	* libio/libio.h: Rename the original version of this file to
	libio/bits/libio.h.  Error out if not included by stdio.h or the
	stub libio.h.
	* include/libio.h: Move to include/bits.  Forward to libio/bits/libio.h.
	* sysdeps/generic/_G_config.h: Move to top-level bits/.  Error out
	if not included by bits/libio.h or the stub _G_config.h.
	* sysdeps/unix/sysv/linux/_G_config.h: Move to
	sysdeps/unix/sysv/linux/bits.  Error out if not included by
	bits/libio.h or the stub _G_config.h.
	* libio/stdio.h: Include bits/libio.h, not libio.h.
	* libio/Makefile: Install bits/libio.h and bits/_G_config.h as
	well as libio.h and _G_config.h.

	* csu/init.c, libio/fmemopen.c, libio/iolibio.h, libio/oldfmemopen.c
	* libio/strfile.h, stdio-common/vfscanf.c
	* sysdeps/pthread/flockfile.c, sysdeps/pthread/funlockfile.c
	Include stdio.h, not _G_config.h nor libio.h.
	* libio/iofgetpos.c: Also rename fgetpos64 out of the way.
	* libio/iofsetpos.c: Also rename fsetpos64 out of the way.

	* scripts/check-installed-headers.sh: Skip libio.h and _G_config.h.
2017-12-24 09:03:28 -08:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Adhemerval Zanella b65b205fbc libio: Fix fmemopen append mode failure (BZ# 20012)
The fmemopen implementation does not account the file position correctly in
append mode. The following example shows the failure:

===
int main ()
{
  char buf[10] = "test";
  FILE *fp = fmemopen (buf, 10, "a+");
  fseek (fp, 0, SEEK_SET);

  int gr;
  if ((gr = getc (fp)) != 't' ||
      (gr = getc (fp)) != 'e' ||
      (gr = getc (fp)) != 's' ||
      (gr = getc (fp)) != 't' ||
      (gr = getc (fp)) != EOF)
    {
      printf ("%s: getc failed returned %i\n", __FUNCTION__, gr);
      return 1;
    }

  return 0;
}
===

This is due both how read and write operation update the buffer position,
taking in consideration buffer lenght instead of maximum position defined
by the open mode.  This patch fixes it and also fixes fseek not returning
EINVAL for invalid whence modes.

Tested on x86_64 and i686.

	[BZ #20012]
	* libio/fmemopen.c (fmemopen_read): Use buffer maximum position, not
	length to calculate the buffer to read.
	(fmemopen_write): Set the buffer position based on bytes written.
	(fmemopen_seek): Return EINVAL for invalid whence modes.
2016-04-29 19:25:17 -03:00
Adhemerval Zanella f9123b5003 libio: Update internal fmemopen position after write (BZ #20005)
Current GLIBC fmemopen fails with a simple testcase:

  char buffer[500] = "x";
  FILE *stream;
  stream = fmemopen(buffer, 500, "r+");
  fwrite("fish",sizeof(char),5,stream);
  printf("pos-1:%ld\n",ftell(stream));
  fflush(stream);
  printf("pos-2:%ld\n",ftell(stream));

It returns:

  pos-1:5
  pos-2:0

Where it should return:

  pos-1:5
  pos-2:5

This is due the internal write function does not correctly update the internal
object position state and then the seek operation returns a wrong value.  This
patch fixes it.

It fixes both BZ #20005 and BZ #19230 (marked as duplicated). A new test is
added to check for such case.

Tested on x86_64 and i686.

	* libio/fmemopen.c (fmemopen_write): Update internal position after
	write.
	* stdio-common/Makefile (tests): Add tst-fmemopen4.c.
	* stdio-common/tst-fmemopen4.c: New file..
2016-04-26 17:40:25 -03:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Paul Pluzhnikov 63e952d9be Fix BZ #18820 -- fmemopen may leak memory on failure. 2015-08-12 23:51:04 -07:00
Adhemerval Zanella 787813b144 libio: Fix fmemopen 'w' mode with provided buffer
If 'w' mode is used with a provided buffer the fmemopen will try to find
the first null byte to set as maximum internal stream size.  It should be
done only for append mode ('a').

Kudos for Stefan Liebler for finding this error on s390-32.

	* libio/fmemopen.c (__fmemopen): Fix 'w' openmode with provided
	buffer.
	* stdio-common/tst-fmemopen2.c (do_test_with_buffer): Fix typo and
	fail output information.
2015-07-16 15:21:49 -03:00
Adhemerval Zanella fdb7d390dd libio: fmemopen rewrite to POSIX compliance
This patch added a new fmemopen version, for glibc 2.22, that aims to be
POSIX complaint.  It fixes some long-stading glibc fmemopen issues, such
as:

* it changes the way fseek with SEEK_END works on fmemopen to seek
  relative to buffer size instead of first '\0'.  This is default mode and
  'b' opening mode does not change internal behavior (bz#6544).

* fix apending opening mode to use as start position either first null
  byte of len specified in function call (bz#13152 and #13151).

* remove binary option 'b' and internal different handling (bz#12836)

* fix seek/SEE_END with negative values (bz#14292).

A compatibility symbol is provided to with old behavior for older symbols
version (2.2.5).

	* include/stdio.h (fmemopen): Remove hidden prototype.
	(__fmemopen): Add new hidden prototype.
	* libio/Makefile: Add oldfmemopen object.
	* libio/Versions [GLIBC_2.22]: Add new fmemopen symbol.
	* libio/fmemopen.c (__fmemopen): Function rewrite to be POSIX
	compliance.
	* libio/oldfmemopen.c: New file: old fmemopen implementation for
	symbol compatibility.
	* stdio-common/Makefile [tests]: Add new tst-fmemopen3.
	* stdio-common/psiginfo.c [psiginfo]: Call __fmemopen instead of
	fmemopen.
	* stdio-common/tst-fmemopen3.c: New file: more fmemopen tests, focus
	on append and read mode.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist [GLIBC_2.22]: Add
	fmemopen.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist [GLIBC_2.22]: Likewise.
2015-07-08 12:07:21 -03:00
Andreas Schwab 7c2ce714d4 Fix buffer overflow for writes to memory buffer stream (bug 18549) 2015-06-25 15:54:09 +02:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Ondřej Bílka a1ffb40e32 Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Ulrich Drepper 13a804de8f Optimize fmemopen a bit. 2011-03-04 00:49:46 -05:00
Andreas Schwab 9d25c392ba Don't read past end of buffer in fmemopen 2011-03-04 00:48:00 -05:00
Ulrich Drepper a99e59d771 * include/stdio.h (fmemopen): Add libc_hidden_proto.
* libio/fmemopen.c (fmemopen): Add libc_hidden_def.

	* elf/sprof.c: Avoid warning about multi-line comment.
2009-03-10 15:26:57 +00:00
Ulrich Drepper 7b3ba2c4eb [BZ #6544]
* libio/fmemopen.c: Implement binary mode.  In this mode no NUL
	byte gets added to writes and seeks from the end use the length of
	the buffer and not the currently terminating NUL byte.
2008-08-14 06:37:17 +00:00
Ulrich Drepper 0292b0dd6c * libio/fmemopen.c (fmemopen): Free stream memory in case of
invalid length [Coverity CID 106].

	* nss/nss_files/files-key.c (search): Close stream before
	successful return [Coverity CID 107].

	* io/fts.c (fts_open): Don't allocate parent if *argv==NULL
	[Coverity CID 108].

	* sunrpc/rpc_cout.c (inline_struct): Free sizestr after use
	[Coverity CID 110, 109].

	* sunrpc/rpc_scan.c (docppline): Free file string if it is not
	going to be used [Coverity CID 111].

	* sysdeps/unix/sysv/linux/getsourcefilter.c (getsourcefilter): Free
	memory if socket level value cannot be retrieved [Coverity CID 112].

	* nis/nis_clone_dir.c (nis_clone_directory): Free all memory in
	error case [Coverity CID 114].

	* nis/nis_clone_res.c (nis_clone_result): Free all memory in the
	error cases [Coverity CID 115].

	* sunrpc/rpc_parse.c (get_definition): Free defp if tok ==
	TOK_EOF [Coverity CID 116].

	* sysdeps/unix/sysv/linux/setsourcefilter.c (setsourcefilter): Free
	memory if socket level value cannot be retrieved [Coverity CID 117].

	* elf/cache.c (save_cache): Initialize pad to avoid writing
	uninitialized data to disk.

	* elf/cache.c (save_cache): Free file_entries_new [Coverity CID 118].

	* intl/finddomain.c (_nl_find_domain): Avoid strdup of expand
	locale name, use strdupa.  Remove free call [Coverity CID 119].

	* sunrpc/rpc_main.c (generate_guard): Avoid extra allocation and
	the resulting leak [Coverity CID 121].

	* sunrpc/rpc_main.c (mkfile_output): Free all allocated memory
	[Coverity CID 122].

	* sunrpc/rpc_main.c (h_output): Free guard after we are done
	[Coverity CID 123].

	* sunrpc/svc_udp.c (cache_set): Free victim if newbuf allocation
	fails [Coverity CID 126].

	* sunrpc/svc_udp.c (svcudp_enablecache): Free memory in error
	cases [Coverity CID 127].

	* nis/nis_table.c (__create_ib_request): Free ibreq in case strdup
	fails [Coverity CID 128].

	* nis/nis_getservlist.c (nis_getservlist): Free all memory in case
	of an error [Coverity CID 130, 129].

	* nis/nis_print_group_entry.c (nis_print_group_entry): If
	nis_lookup call failed, return.  Free lookup result in error
	cases [Coverity CID 131].

	* nis/nis_removemember.c (nis_removemember): Free all memory in
	error cases [Coverity CID 132].

	* nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r):
	Always free lookup result [Coverity CID 134].

	* nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_gethostton_r):
	Always free lookup result [Coverity CID 135].

	* nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_getntohost_r):
	Always free lookup result [Coverity CID 136].

	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_getnetbyaddr_r):
	Before retrying, free old result [Coverity CID 137].

	* nis/nss_nisplus/nisplus-publickey.c (_nss_nisplus_netname2user):
	Free res in case UID is zero [Coverity CID 138].

	* nis/ypclnt.c (yp_update): Always free master string
	[Coverity CID 140].

	* nis/nis_creategroup.c (nis_creategroup): Free all memory in
	error cases [Coverity CID 143, 142, 141].

	* nis/nss_nis/nis-publickey.c (_nss_nis_getpublickey): Free result
	if yp_match call succeeded [Coverity CID 155].

	* nis/nss_nis/nis-publickey.c (_nss_nis_getsecretkey): Free string
	allocated in yp_match at all times [Coverity CID 157, 156].

	* nscd/nscd.c (write_pid): Close stream also if writing failed
	[Coverity CID 165].

	* nis/nis_table.c (nis_add_entry): Move test for NULL parameter
	ahead of first use [Coverity CID 167].

	* nis/nss_nis/nis-alias.c (_nss_nis_getaliasbyname_r): Move test
	for NULL parameter ahead of first use [Coverity CID 168].

	* intl/finddomain.c (_nl_find_domain): We never return NULL if we
	found the locale [Coverity CID 169].

	* inet/getnameinfo.c (getnameinfo): __getservbyport_r does not set
	herrno [Coverity CID 178].

	* nis/nis_checkpoint.c (nis_checkpoint): Don't access and returned
	freed object [Coverity CID 182].
2006-04-07 04:29:25 +00:00
Ulrich Drepper 32053042d4 [BZ #394]
2005-09-23  Ulrich Drepper  <drepper@redhat.com>
	[BZ #394]
	* libio/fmemopen.c (fmemopen_write): Return 0 instead of -1 if
	nothing can be written.
	* libio/iofopncook.c (_IO_cookie_write): If something went wrong,
	set error bit.
2005-09-23 16:36:09 +00:00
Roland McGrath 69553a9bd8 * sysdeps/mach/hurd/tls.h: Include <stdbool.h>
(dtv_t): Change pointer type to be a struct which also contains
	information whether the memory pointed to is static TLS or not.

	* sysdeps/generic/syslog.c (send_flags) [!send_flags]: Define it.

	* shadow/sgetspent_r.c (FALSE): Macro renamed to ...
	(FALSEP): ... this.  Updated all references.

	* libio/fmemopen.c: Include <stdint.h>.
2005-02-02 19:44:07 +00:00
Ulrich Drepper 1b99d99f0e Update.
* libio/fmemopen.c (fmemopen_seek): SEEK_END should count from
	maximum used address, not maximum buffer position.
2005-01-06 02:09:15 +00:00
Ulrich Drepper 1e7cceb99e Update.
* libio/iofopncook.c (_IO_cookie_seekoff): Define.  Mark offset as
	invalid to disable optimizations in fileops which won't work here.
	(_IO_cookie_jumps): Use it.
	(_IO_old_cookie_jumps): Likewise.
	* libio/fmemopen.c (fmemopen_seek): Result must be returned in *P,
	not the return value.
	* stdio-common/Makefile (tests): Add tst-fmemopen2.
	* stdio-common/tst-fmemopen2.c: New file.
2005-01-06 00:42:22 +00:00
Ulrich Drepper a334319f65 (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. 2004-12-22 20:10:10 +00:00
Jakub Jelinek 0ecb606cb6 2.5-18.1 2007-07-12 18:26:36 +00:00
Ulrich Drepper 6dd67bd565 Update.
2002-08-24  Ulrich Drepper  <drepper@redhat.com>

	* locale/programs/charmap.c (charmap_new_char): Don't use
	ULONG_MAX as maximum UCS4 value.

	* sysdeps/unix/sysv/linux/ia64/sys/user.h: New file.

	* sysdeps/generic/strtol.c: We don't need the isascii test in glibc.

	* malloc/hooks.c (public_sET_STATe): use size_t as type for i.
	* malloc/malloc.c (mALLINFo): Likewise.

	* libio/wstrops.c (_IO_wstr_pbackfail): Use WEOF in comparison.

	* libio/wfileops.c (_IO_wfile_overflow): Use EOF not WEOF when
	examining result of _IO_do_flush call.

	* stdio-common/vfprintf.c (vfprintf): Use correct type in va_arg.
	Use prec not spec when sizing buffers.

	* catgets/open_catalog.c (__open_catalog): Add casts to avoid warnings.
	* locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
	* locale/loadlocale.c (_nl_intern_locale_data): Likewise.
	* stdio-common/vfscanf.c (inchar): Likewise.
	* misc/efgcvt_r.c (fcvt_r): Likewise.
	* elf/dl-misc.c (_dl_debug_vdprintf): Likewise.
	* elf/readlib.c (process_file): Likewise.
	* elf/sprof.c (load_profdata): Likewise.
	* sysdeps/ia64/hp-timing.h (HP_TIMING_PRINT): Likewise.
	* locale/programs/linereader.c (get_toplvl_escape): Likewise.
	* locale/programs/charmap.c (charmap_read): Likewise.
	* libio/fileops.c: Likewise.
	* libio/fmemopen.c: Likewise.
	* stdlib/strtod.c: Likewise.
	* elf/dl-load.c: Likewise.
	* iconv/iconvconfig.c: Likewise.
	* iconv/iconv_prog.c (process_block): Likewise.

	* sysdeps/unix/sysv/linux/ia64/Makefile: Define _ASM_IA64_CURRENT_H
	macro to calm down the compiler.

	* iconv/gconv_cache.c (__gconv_load_cache): Add cast to avoid warning.

	* sysdeps/ia64/elf/initfini.c: Don't use newlines embedded in string.

	* sysdeps/unix/sysv/linux/i386/sysdep.S: Update comment regarding
	placement of errno definition.
	* sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/mips/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise.

	* resolv/nss_dns/dns-host.c (MAXPACKET): Increase minimum value
	from 1024 to 65536, to avoid buffer overrun.

2002-08-16  Paul Eggert  <eggert@twinsun.com>

	* resolv/gethnamaddr.c (MAXPACKET): Increase minimum value
	from 1024 to 65536, to avoid buffer overrun.
	* resolv/res_query.c (MAXPACKET): Likewise.

	architectures.
2002-08-25 04:51:08 +00:00
Ulrich Drepper 3ba06713f8 Update.
2002-08-04  Jakub Jelinek  <jakub@redhat.com>

	* manual/debug.texi: Fix spelling to programmatically.
	Reported by <hayastan132@hotmail.com>.

	* include/libio.h: Add libc_hidden_proto for __uflow.
	* include/stdio.h: Map fopen, fdopen, fclose, fputs, fsetpos, and
	fgetpos to _IO_* names.
	Add libc_hidden_proto for fileno, fwrite, fseek, fflush_unlocked,
	fread_unlocked, fwrite_unlocked, fgets_unlocked, fputs_unlocked.
	* include/wchar.h: Add libc_hidden_proto for fputws_unlocked,
	putwc_unlocked, vswscanf.
	* libio/iolibio.h: Add libc_hidden_proto for _IO_fputs.
	* libio/fileno.c: Use <stdio.h> and libc_hidden_def.
	* libio/fseek.c: Likewise.
	* libio/fmemopen.c: Include "libioP.h".  Call _IO_fopencookie and
	not fopencookie.
	* libio/genops.c (__uflow): Add libc_hidden_def.
	* libio/iofflush_u.c (fflush_unlocked): Likewise.
	* libio/iofgets_u.c (fgets_unlocked): Likewise.
	* libio/iofputs_u.c (fputs_unlocked): Likewise.
	* libio/iofputws_u.c (fputws_unlocked): Likewise.
	* libio/iofread_u.c (fread_unlocked): Likewise.
	* libio/iofwrite_u.c (fwrite_unlocked): Likewise.
	* libio/iovswscanf.c (vswscanf): Likewise.
	* libio/putwc_u.c (putwc_unlocked): Likewise.
	* libio/iofputs.c: Use libc_hidden_def instead of INTDEF.
	* malloc/malloc.c: Redirect fwrite calls to _IO_fwrite.
	* malloc/mtrace.c: Likewise.

	* sunrpc/clnt_perr.c: Remove fputs macro.
	* sunrpc/svc_simple.c: Likewise.
	* sunrpc/svc_tcp.c: Likewise.
	* sunrpc/svc_udp.c: Likewise.
	* sunrpc/xdr_rec.c: Likewise.
	* sunrpc/xdr_ref.c: Likewise.

	* iconv/Makefile: Add CPPFLAGS definitions with -DNOT_in_libc for
	iconv_prog, linereader, and charmap-dir.
	* locale/Makefile: Likewise for locale and charmap-dir.
	* malloc/Makefile: Likewise for memusagestat.
	* nscd/Makefile: Likewise for nscd, nscd_conf, and dbg_log.
	* sunrpc/Makefile: Likewise for rpc_main.
	* sysdeps/unix/sysv/linux/Makefile: Likewise for lddlibc4.
	* timezone/Makefile: Likewise for zic.

	* stdio-common/perror.c: Avoid multiple calls to fileno_unlocked.
2002-08-04 20:54:20 +00:00
Andreas Jaeger 41bdb6e20c Update to LGPL v2.1.
2001-07-06  Paul Eggert  <eggert@twinsun.com>

	* manual/argp.texi: Remove ignored LGPL copyright notice; it's
	not appropriate for documentation anyway.
	* manual/libc-texinfo.sh: "Library General Public License" ->
	"Lesser General Public License".

2001-07-06  Andreas Jaeger  <aj@suse.de>

	* All files under GPL/LGPL version 2: Place under LGPL version
	2.1.
2001-07-06 04:58:11 +00:00
Andreas Jaeger 1a511d3105 Update.
2000-12-15  Andreas Jaeger  <aj@suse.de>

	* stdio-common/scanf9.c (main): Reformat and change to avoid
	warnings.

	* stdio-common/tstdiomisc.c: Make local functions static.
	* stdio-common/tst-printf.c: Likewise.

	* elf/constload2.c: Add prototype declarations to shut up gcc.
	* elf/dep1.c: Likewise.
	* elf/dep2.c: Likewise.
	* elf/dep3.c: Likewise.
	* elf/dep4.c: Likewise.
	* elf/ltglobmod2.c: Likewise.

	* libio/fmemopen.c: Make local functions static.

	* elf/Makefile (distribute): Added testobj.h.

	* elf/testobj.h: New file.

	* elf/testobj1.c: Include testobj.h and move prototype
	declarations to testobj.h.
	* elf/testobj2.c: Likewise.
	* elf/testobj3.c: Likewise.
	* elf/testobj4.c: Likewise.
	* elf/testobj5.c: Likewise.
	* elf/testobj6.c: Likewise.
	* elf/testobj1_1.c: Likewise.
	* elf/preloadtest.c: Likewise.
2000-12-15 16:03:57 +00:00
Ulrich Drepper de153e7f50 Update.
* stdio-common/Makefile (tests): Add tst-fmemopen.
	* stdio-common/tst-fmemopen.c: New file.
	Test case by Ben Collins <bcollins@debian.org>.

	* libio/iofopncook.c (_IO_cookie_seek): Correct test for error.

	* libio/fmemopen.c (fmemopen_read): Return 0 at end of buffer.
	(fmemopen_write): Set errno at end of buffer.
2000-10-31 05:20:53 +00:00
Andreas Jaeger 3146ad427a Update.
2000-09-02  Andreas Jaeger  <aj@suse.de>

	* sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Fixes for fcntl64.

	* libio/fmemopen.c (fmemopen_close): Revert one part of last
	patch.
2000-09-02 15:05:15 +00:00
Ulrich Drepper c6cc2207a5 Update.
2000-09-01  Ulrich Drepper  <drepper@redhat.com>

	* libio/fmemopen.c (fmemopen_seek): Add default case in switch
	statement.  General cleanup.
2000-09-01 21:16:28 +00:00
Ulrich Drepper 46e4bd3b8e Update.
* libio/stdio.h: Add fmemopen prototype.

2000-08-25  Andreas Jaeger  <aj@suse.de>

	* libio/Makefile (routines): Add fmemopen.
	(tests): Add test-fmemopen.
	* libio/Versions: Add fmemopen with version GLIBC_2.2.
	* libio/test-fmemopen.c: New file.
	* libio/fmemopen.c: New file.
	Patches by Hanno Mueller <kontakt@hanno.de>.

2000-08-28  Ulrich Drepper  <drepper@redhat.com>
2000-08-29 02:54:55 +00:00