diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-10-09 19:04:57 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-10-09 19:04:57 +0200 |
commit | 7bb5f8a836b916d6ebf7b6921b136e99cea2442d (patch) | |
tree | 28a7ed786dae726ad14f100e8626eee872b1ba11 /misc | |
parent | f76453c31593957fec1a99b986bfa5506618b79c (diff) | |
parent | ab30899d880f9741a409cbc0d7a28399bdac21bf (diff) |
Merge tag 'glibc-2.23' into baseline
The GNU C Library
=================
The GNU C Library version 2.23 is now available.
The GNU C Library is used as *the* C library in the GNU system and
in GNU/Linux systems, as well as many other systems that use Linux
as the kernel.
The GNU C Library is primarily designed to be a portable
and high performance C library. It follows all relevant
standards including ISO C11 and POSIX.1-2008. It is also
internationalized and has one of the most complete
internationalization interfaces known.
The GNU C Library webpage is at http://www.gnu.org/software/libc/
Packages for the 2.23 release may be downloaded from:
http://ftpmirror.gnu.org/libc/
http://ftp.gnu.org/gnu/libc/
The mirror list is at http://www.gnu.org/order/ftp.html
NEWS for version 2.23
=====================
* Unicode 8.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 8.0.0, using new
and/or improved generator scripts contributed by Mike FABIAN (Red Hat).
These updates cause user visible changes, such as the fixes for bugs
89, 16061, and 18568.
* sched_setaffinity, pthread_setaffinity_np no longer attempt to guess the
kernel-internal CPU set size. This means that requests that change the
CPU affinity which failed before (for example, an all-ones CPU mask) will
now succeed. Applications that need to determine the effective CPU
affinities need to call sched_getaffinity or pthread_getaffinity_np after
setting it because the kernel can adjust it (and the previous size check
would not detect this in the majority of cases).
* The fts.h header can now be used with -D_FILE_OFFSET_BITS=64. With LFS
the following new symbols are used: fts64_children, fts64_close,
fts64_open, fts64_read and fts64_set.
* getaddrinfo now detects certain invalid responses on an internal netlink
socket. If such responses are received, an affected process will
terminate with an error message of "Unexpected error <number> on netlink
descriptor <number>" or "Unexpected netlink response of size <number> on
descriptor <number>". The most likely cause for these errors is a
multi-threaded application which erroneously closes and reuses the netlink
file descriptor while it is used by getaddrinfo.
* A defect in the malloc implementation, present since glibc 2.15 (2012) or
glibc 2.10 via --enable-experimental-malloc (2009), could result in the
unnecessary serialization of memory allocation requests across threads.
The defect is now corrected. Users should see a substantial increase in
the concurent throughput of allocation requests for applications which
trigger this bug. Affected applications typically create create and
destroy threads frequently. (Bug 19048 was reported and analyzed by
Ericsson.)
* There is now a --disable-timezone-tools configure option for disabling the
building and installing of the timezone related utilities (zic, zdump, and
tzselect). This is useful for people who build the timezone data and code
independent of the GNU C Library.
* The obsolete header <regexp.h> has been removed. Programs that require
this header must be updated to use <regex.h> instead.
* The obsolete functions bdflush, create_module, get_kernel_syms,
query_module and uselib are no longer available to newly linked binaries;
the header <sys/kdaemon.h> has been removed. These functions and header
were specific to systems using the Linux kernel and could not usefully be
used with the GNU C Library on systems with version 2.6 or later of the
Linux kernel.
* Optimized string, wcsmbs and memory functions for IBM z13.
Implemented by Stefan Liebler.
* Newly linked programs that define a variable called signgam will no longer
have it set by the lgamma, lgammaf and lgammal functions. Programs that
require signgam to be set by those functions must ensure that they use the
variable provided by the GNU C Library and declared in <math.h>, without
defining their own copy.
* The minimum GCC version that can be used to build this version of the GNU
C Library is GCC 4.7. Older GCC versions, and non-GNU compilers, can
still be used to compile programs using the GNU C Library.
Security related changes:
* An out-of-bounds value in a broken-out struct tm argument to strftime no
longer causes a crash. Reported by Adam Nielsen. (CVE-2015-8776)
* The LD_POINTER_GUARD environment variable can no longer be used to disable
the pointer guard feature. It is always enabled. Previously,
LD_POINTER_GUARD could be used to disable security hardening in binaries
running in privileged AT_SECURE mode. Reported by Hector Marco-Gisbert.
(CVE-2015-8777)
* An integer overflow in hcreate and hcreate_r could lead to an
out-of-bounds memory access. Reported by Szabolcs Nagy. (CVE-2015-8778)
* The catopen function no longer has unbounded stack usage. Reported by
Max. (CVE-2015-8779)
* The nan, nanf and nanl functions no longer have unbounded stack usage
depending on the length of the string passed as an argument to the
functions. Reported by Joseph Myers. (CVE-2014-9761)
* A stack-based buffer overflow was found in libresolv when invoked from
libnss_dns, allowing specially crafted DNS responses to seize control
of execution flow in the DNS client. The buffer overflow occurs in
the functions send_dg (send datagram) and send_vc (send TCP) for the
NSS module libnss_dns.so.2 when calling getaddrinfo with AF_UNSPEC
family. The use of AF_UNSPEC triggers the low-level resolver code to
send out two parallel queries for A and AAAA. A mismanagement of the
buffers used for those queries could result in the response of a query
writing beyond the alloca allocated buffer created by
_nss_dns_gethostbyname4_r. Buffer management is simplified to remove
the overflow. Thanks to the Google Security Team and Red Hat for
reporting the security impact of this issue, and Robert Holiday of
Ciena for reporting the related bug 18665. (CVE-2015-7547)
The following bugs are resolved with this release:
[89] localedata: Locales nb_NO and nn_NO should transliterate æøå
[887] math: Math library function "logb" and "nextafter" inconsistent
[2542] math: Incorrect return from float gamma (-0X1.FA471547C2FE5P+1)
[2543] math: Incorrect return from float gamma (-0X1.9260DCP+1)
[2558] math: Incorrect return from double gamma (-0X1.FA471547C2FE5P+1)
[2898] libc: [improve] warning: the use of `mktemp' is dangerous, better
use `mkstemp'
[4404] localedata: German translation of "Alarm clock" is misleading
[6799] math: nextafter() and nexttoward() doen't set errno on
overflow/underflow errors
[6803] math: scalb(), scalbln(), scalbn() do not set errno on
overflow/underflow
[10432] nis: _nss_nis_setnetgrent assertion failure
[11460] libc: fts has no LFS support
[12926] network: getaddrinfo()/make_request() may spin forever
[13065] nptl: Race condition in pthread barriers
[13690] nptl: pthread_mutex_unlock potentially cause invalid access
[14341] dynamic-link: Dynamic linker crash when DT_JMPREL and DT_REL{,A}
are not contiguous
[14551] math: [ldbl-128ibm] strtold overflow handling for IBM long double
[14912] libc: Rename non-installed bits/*.h headers
[15002] libc: Avoid undefined behavior in posix_fallocate overflow check
[15367] math: Let gcc use __builtin_isinf
[15384] math: One constant fewer in ieee754/dbl-64/wordsize-64/s_finite.c
[15421] math: lgamma wrongly sets signgam for ISO C
[15470] math: [arm] On ARM llrintl() and llroundl() do not raise
FE_INVALID with argument out of range
[15491] math: [i386/x86_64] x86 nearbyint implementations wrongly clear
all exceptions
[15786] dynamic-link: ifunc resolver functions can smash function
arguments
[15918] math: Unnecessary check for equality in hypotf()
[16061] localedata: Review / update transliteration data
[16068] math: [i386/x86_64] x86 and x86_64 fesetenv exclude state they
should include
[16141] time: strptime %z offset restriction
[16171] math: drem should be alias of remainder
[16296] math: fegetround is pure?
[16347] math: [ldbl-128ibm] ldbl-128/e_lgammal_r.c may not be suitable.
[16364] libc: sleep may leave SIGCHLD blocked on sync cancellation on
GNU/Linux
[16399] math: [mips] lrint / llrint / lround / llround missing exceptions
[16415] math: Clean up ldbl-128 / ldbl-128ibm expm1l for large positive
arguments
[16422] math: [powerpc] math-float, math-double failing llrint tests with
"Exception "Inexact" set" on ppc32
[16495] localedata: nl_NL: date_fmt: shuffle year/month around
[16517] math: Missing underflow exception from tanf/tan/tanl
[16519] math: Missing underflow exception from sinhf
[16520] math: Missing underflow exception from tanhf
[16521] math: Missing underflow exception from exp2
[16620] math: [ldbl-128ibm] exp10l spurious overflows / bad directed
rounding results
[16734] stdio: fopen calls mmap to allocate its buffer
[16961] math: nan function incorrect handling of bad sequences
[16962] math: nan function unbounded stack allocation (CVE-2014-9761)
[16973] localedata: Fix lang_lib/lang_term as per ISO 639-2
[16985] locale: localedef: confusing error message when opening output
fails
[17118] math: ctanh(INFINITY + 2 * I) returns incorrect value
[17197] locale: Redundant shift character in iconv conversion output at
block boundary
[17243] libc: trunk/posix/execl.c:53: va_args problem ?
[17244] libc: trunk/sysdeps/unix/sysv/linux/semctl.c:116: va_args muxup ?
[17250] dynamic-link: static linking breaks nss loading
(getaddrinfo/getpwnam/etc...)
[17404] libc: atomic_exchange_rel lacking a barrier on MIPS16, GCC before
4.7?
[17441] math: isnan() should use __builtin_isnan() in GCC
[17514] nptl: Assert failure unlocking ERRORCHECK mutex after timedlock
(related to lock elision)
[17787] manual: Exponent on page 324 of the PDF ends prematurely
[17886] time: strptime should be able to parse "Z" as a timezone with %z
[17887] time: strptime should be able to parse "+01:00" style timezones
[17905] libc: catopen() Multiple unbounded stack allocations
(CVE-2015-8779)
[18084] libc: backtrace (..., 0) dumps core on x86
[18086] libc: nice() sets errno to 0 on success
[18240] libc: hcreate, hcreate_r should fail with ENOMEM if element count
is too large (CVE-2015-8778)
[18251] dynamic-link: SONAME missing when audit modules provides path
[18265] libc: add attributes for wchar string and memory functions
[18370] math: csqrt missing underflows
[18421] libc: [hppa] read-only segment has dynamic relocations
[18472] libc: Obsolete syscall wrappers should be compat symbols
[18480] libc: hppa glibc miscompilation in sched_setaffinity()
[18491] localedata: Update tr_TR LC_CTYPE as part of Unicode updates
[18525] localedata: Remove locale timezone information
[18560] libc: [powerpc] spurious bits/ipc.h definitions
[18568] localedata: Update locale data to Unicode 8.0
[18589] locale: sort-test.sh fails at random
[18595] math: ctan, ctanh missing underflows
[18604] libc: assert macro-expands its argument
[18610] math: S390: fetestexcept() reports any exception if DXC-code
contains a vector instruction exception.
[18611] math: j1, jn missing errno setting on underflow
[18618] localedata: sync Chechen locale definitions with other *_RU
locales
[18647] math: powf(-0x1.000002p0, 0x1p30) returns 0 instead of +inf
[18661] libc: Some x86-64 assembly codes don't align stack to 16 bytes
[18665] network: In send_dg, the recvfrom function is NOT always using the
buffer size of a newly created buffer (CVE-2015-7547)
[18674] libc: [i386] trunk/sysdeps/i386/tst-auditmod3b.c:84: possible
missing break ?
[18675] libc: fpathconf(_PC_NAME_MAX) fails against large filesystems for
32bit processes
[18681] libc: regexp.h is obsolete and buggy, and should be desupported
[18699] math: tilegx cproj() for various complex infinities does not yield
infinity
[18724] libc: Harden put*ent functions against data injection
[18743] nptl: PowerPC: findutils testcase fails with --enable-lock-elision
[18755] build: build errors with -DNDEBUG
[18757] stdio: fmemopen fails to set errno on failure
[18778] dynamic-link: ld.so crashes if failed dlopen causes libpthread to
be forced unloaded
[18781] libc: openat64 lacks O_LARGEFILE
[18787] libc: [hppa] sysdeps/unix/sysv/linux/hppa/bits/atomic.h:71:6:
error: can’t find a register in class ‘R1_REGS’ while reloading ‘asm’
[18789] math: [ldbl-128ibm] sinhl inaccurate near 0
[18790] math: [ldbl-128ibm] tanhl inaccurate
[18795] libc: stpncpy fortification misses buffer lengths that are
statically too large
[18796] build: build fails for --disable-mathvec
[18803] math: hypot missing underflows
[18820] stdio: fmemopen may leak memory on failure
[18823] math: csqrt spurious underflows
[18824] math: fma spurious underflows
[18825] math: pow missing underflows
[18857] math: [ldbl-128ibm] nearbyintl wrongly uses signaling comparisons
[18868] nptl: pthread_barrier_init typo has in-theory-undefined behavior
[18870] build: sem_open.c fails to compile with missing symbol
FUTEX_SHARED
[18872] stdio: Fix memory leak in printf_positional
[18873] libc: posix_fallocate overflow check ineffective
[18875] math: Excess precision leads incorrect libm
[18877] libc: arm: mmap offset regression
[18887] libc: memory corruption when using getmntent on blank lines
[18918] localedata: hu_HU: change time to HH:MM:SS format
[18921] libc: Regression: extraneous stat() and fstat() performed by
opendir()
[18928] dynamic-link: LD_POINTER_GUARD is not ignored for privileged
binaries (CVE-2015-8777)
[18951] math: tgamma missing underflows
[18952] math: [ldbl-128/ldbl-128ibm] lgammal spurious "invalid", incorrect
signgam
[18953] localedata: lt_LT: change currency symbol to the euro
[18956] math: powf inaccuracy
[18961] math: [i386] exp missing underflows
[18966] math: [i386] exp10 missing underflows
[18967] math: math.h XSI POSIX namespace (gamma, isnan, scalb)
[18969] build: multiple string test failures due to missing locale
dependencies
[18970] libc: Reference of pthread_setcancelstate in libc.a
[18977] math: float / long double Bessel functions not in XSI POSIX
[18980] math: i386 libm functions return with excess range and precision
[18981] math: i386 scalb*, ldexp return with excess range and precision
[18982] stdio: va_list and vprintf
[18985] time: Passing out of range data to strftime() causes a segfault
(CVE-2015-8776)
[19003] math: [x86_64] fma4 version of pow inappropriate contraction
[19007] libc: FAIL: elf/check-localplt with -z now and binutils 2.26
[19012] locale: iconv_open leaks memory on error path
[19016] math: clog, clog10 inaccuracy
[19018] nptl: Mangle function pointers in tls_dtor_list
[19032] math: [i386] acosh (-qNaN) spurious "invalid" exception
[19046] math: ldbl-128 / ldbl-128ibm lgamma bad overflow handling
[19048] malloc: malloc: arena free list can become cyclic, increasing
contention
[19049] math: [powerpc] erfc incorrect zero sign
[19050] math: [powerpc] log* incorrect zero sign
[19058] math: [x86_64] Link fail with -fopenmp and -flto
[19059] math: nexttoward overflow incorrect in non-default rounding modes
[19071] math: ldbl-96 lroundl incorrect just below powers of 2
[19074] network: Data race in _res_hconf_reorder_addrs
[19076] math: [ldbl-128ibm] log1pl (-1) wrong sign of infinity
[19077] math: [ldbl-128ibm] logl (1) incorrect sign of zero result
[19078] math: [ldbl-128ibm] expl overflow incorrect in non-default
rounding modes
[19079] math: dbl-64/wordsize-64 lround based on llround incorrect for
ILP32
[19085] math: ldbl-128 lrintl, lroundl missing exceptions for 32-bit long
[19086] manual: posix_fallocate64 documented argument order is wrong.
[19088] math: lround, llround missing exceptions close to overflow
threshold
[19094] math: lrint, llrint missing exceptions close to overflow threshold
[19095] math: dbl-64 lrint incorrect for 64-bit long
[19122] dynamic-link: Unnecessary PLT relocations in librtld.os
[19124] dynamic-link: ld.so failed to build with older assmebler
[19125] math: [powerpc32] llroundf, llround incorrect exceptions
[19129] dynamic-link: [arm] Concurrent lazy TLSDESC resolution can crash
[19134] math: [powerpc32] lround, lroundf spurious exceptions
[19137] libc: i386/epoll_pwait.S doesn't support cancellation
[19143] nptl: Remove CPU set size checking from sched_setaffinity,
pthread_setaffinity_np
[19156] math: [ldbl-128] j0l spurious underflows
[19164] nptl: tst-getcpu fails with many possible CPUs
[19168] math: math/test-ildoubl and math/test-ldouble failure
[19174] nptl: PowerPC: TLE enabled pthread mutex performs poorly.
[19178] dynamic-link: ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA confuses
prelink
[19181] math: [i386/x86_64] fesetenv (FE_DFL_ENV), fesetenv
(FE_NOMASK_ENV) do not clear SSE exceptions
[19182] malloc: malloc deadlock between ptmalloc_lock_all and
_int_new_arena/reused_arena
[19189] math: [ldbl-128] log1pl (-qNaN) spurious "invalid" exception
[19201] math: dbl-64 remainder incorrect sign of zero result
[19205] math: bits/math-finite.h conditions do not match math.h and
bits/mathcalls.h
[19209] math: bits/math-finite.h wrongly maps ldexp to scalbn
[19211] math: lgamma functions do not set signgam for -ffinite-math-only
for C99-based standards
[19212] libc: features.h not -Wundef clean
[19213] math: [i386/x86_64] log* (1) incorrect zero sign for -ffinite-
math-only
[19214] libc: Family and model identification for AMD CPU's are incorrect.
[19219] libc: GLIBC build fails for ia64 with missing __nearbyintl
[19228] math: [powerpc] nearbyint wrongly clears "inexact", leaves traps
disabled
[19235] math: [powerpc64] lround, lroundf, llround, llroundf spurious
"inexact" exceptions
[19238] math: [powerpc] round, roundf spurious "inexact" for integer
arguments
[19242] libc: strtol incorrect in Turkish locales
[19243] malloc: reused_arena can pick an arena on the free list, leading
to an assertion failure and reference count corruption
[19253] time: tzset() ineffective when temporary TZ did not include DST
rules
[19266] math: strtod ("NAN(I)") incorrect in Turkish locales
[19270] math: [hppa] Shared libm missing __isnanl
[19285] libc: [hppa] sysdeps/unix/sysv/linux/hppa/bits/mman.h: missing
MAP_HUGETLB and MAP_STACK defines
[19313] nptl: Wrong __cpu_mask for x32
[19347] libc: grantpt: try to force a specific gid even without pt_chown
[19349] math: [ldbl-128ibm] tanhl inaccurate for small arguments
[19350] math: [ldbl-128ibm] sinhl spurious overflows
[19351] math: [ldbl-128ibm] logl inaccurate near 1
[19363] time: x32: times() return value wrongly truncates/sign extends
from 32bit
[19367] dynamic-link: Improve branch prediction on Silvermont
[19369] network: Default domain name not reset by res_ninit when "search"
/ "domain" entry is removed from resolv.conf
[19375] math: powerpc: incorrect results for POWER7 logb with negative
subnormals
[19385] localedata: bg_BG: time separator should be colon, not comma
[19408] libc: linux personality syscall wrapper may erroneously return an
error on 32-bit architectures
[19415] libc: dladdr returns wrong names on hppa
[19432] libc: iconv rejects redundant escape sequences in IBM900, IBM903,
IBM905, IBM907, and IBM909
[19439] math: Unix98 isinf and isnan functions conflict with C++11
[19443] build: build failures with -DDEBUG
[19451] build: Make check fails on test-double-vlen2
[19462] libc: Glibc failed to build with -Os
[19465] math: Wrong code with -Os
[19466] time: time/tst-mktime2.c is compiled into an infinite loop with
-Os
[19467] string: Fast_Unaligned_Load needs to be enabled for Excavator core
CPU's.
[19475] libc: Glibc 2.22 doesn't build on sparc [PATCH]
[19486] math: S390: Math tests fail with "Exception Inexact set".
[19529] libc: [ARM]: FAIL: stdlib/tst-makecontext
[19550] libc: [mips] mmap negative offset handling inconsistent with other
architectures
[19590] math: Fail to build shared objects that use libmvec.so functions.
Contributors
============
This release was made possible by the contributions of many people.
The maintainers are grateful to everyone who has contributed
changes or bug reports. These include:
Adhemerval Zanella
Alan Modra
Amit Pawar
Andreas Schwab
Andrew Bennett
Andrew Senkevich
Andrew Stubbs
Anton Blanchard
Arjun Shankar
Arslanbek Astemirov
Aurelien Jarno
Brett Neumeier
Carlos Eduardo Seo
Carlos O'Donell
Chris Metcalf
Chung-Lin Tang
Damyan Ivanov
Daniel Marjamäki
David Kastrup
David Lamparter
David S. Miller
Dmitry V. Levin
Egmont Koblinger
Evert
Flavio Cruz
Florian Weimer
Gabriel F. T. Gomes
Geoffrey Thomas
Gleb Fotengauer-Malinovskiy
Gunnar Hjalmarsson
H.J. Lu
Helge Deller
James Perkins
John David Anglin
Joseph Myers
Justus Winter
Khem Raj
Ludovic Courtès
Maciej W. Rozycki
Manolis Ragkousis
Marcin Kościelnicki
Mark Wielaard
Marko Myllynen
Martin Sebor
Maxim Ostapenko
Mike FABIAN
Mike Frysinger
Namhyung Kim
Ondrej Bilka
Ondřej Bílka
Paul E. Murphy
Paul Eggert
Paul Murphy
Paul Pluzhnikov
Petar Jovanovic
Phil Blundell
Rajalakshmi Srinivasaraghavan
Rasmus Villemoes
Richard Henderson
Rob Wu
Roland McGrath
Samuel Thibault
Siddhesh Poyarekar
Stan Shebs
Stefan Liebler
Steve Ellcey
Szabolcs Nagy
Thomas Schwinge
Torvald Riegel
Tulio Magno Quites Machado Filho
Vincent Bernat
Wilco Dijkstra
Zack Weinberg
Diffstat (limited to 'misc')
146 files changed, 492 insertions, 627 deletions
diff --git a/misc/Makefile b/misc/Makefile index aecb0dae9d..d7bbc85f18 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2015 Free Software Foundation, Inc. +# Copyright (C) 1991-2016 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -76,7 +76,8 @@ install-lib := libg.a gpl2lgpl := error.c error.h tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \ - tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 + tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \ + tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 ifeq ($(run-built-tests),yes) tests-special += $(objpfx)tst-error1-mem.out endif diff --git a/misc/Versions b/misc/Versions index 534d1a3fca..671f4870e9 100644 --- a/misc/Versions +++ b/misc/Versions @@ -149,6 +149,9 @@ libc { GLIBC_2.16 { __getauxval; getauxval; } + GLIBC_2.23 { + # SHLIB_COMPAT(GLIBC_2_0, GLIBC_2_23) used in regexp.c + } GLIBC_PRIVATE { __madvise; __mktemp; diff --git a/misc/acct.c b/misc/acct.c index c5569e5afa..74ff43a233 100644 --- a/misc/acct.c +++ b/misc/acct.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,8 +22,7 @@ a record for each process as it terminates, to this file. If NAME is NULL, turn accounting off. This call is restricted to the super-user. */ int -acct (name) - const char *name; +acct (const char *name) { __set_errno (ENOSYS); return -1; @@ -1,5 +1,5 @@ /* Header describing `ar' archive file format. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/bits/error.h b/misc/bits/error.h index d903bcdbb4..84082897f8 100644 --- a/misc/bits/error.h +++ b/misc/bits/error.h @@ -1,5 +1,5 @@ /* Specializations for error functions. - Copyright (C) 2007-2015 Free Software Foundation, Inc. + Copyright (C) 2007-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/bits/select2.h b/misc/bits/select2.h index 9b37e3bdb3..56f2205ad5 100644 --- a/misc/bits/select2.h +++ b/misc/bits/select2.h @@ -1,5 +1,5 @@ /* Checking macros for select functions. - Copyright (C) 2011-2015 Free Software Foundation, Inc. + Copyright (C) 2011-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/bits/stab.def b/misc/bits/stab.def index 68df2db56e..2af2ddfc63 100644 --- a/misc/bits/stab.def +++ b/misc/bits/stab.def @@ -1,5 +1,5 @@ /* Table of DBX symbol codes for the GNU system. - Copyright (C) 1988, 1997-2015 Free Software Foundation, Inc. + Copyright (C) 1988, 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/bits/syslog-ldbl.h b/misc/bits/syslog-ldbl.h index 7e5362d44a..7c1c03de95 100644 --- a/misc/bits/syslog-ldbl.h +++ b/misc/bits/syslog-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for syslog functions. - Copyright (C) 2006-2015 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h index 7a84be4eac..31dae38e57 100644 --- a/misc/bits/syslog.h +++ b/misc/bits/syslog.h @@ -1,5 +1,5 @@ /* Checking macros for syslog functions. - Copyright (C) 2005-2015 Free Software Foundation, Inc. + Copyright (C) 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/brk.c b/misc/brk.c index 28c4203399..76bd1b740d 100644 --- a/misc/brk.c +++ b/misc/brk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,8 +24,7 @@ void *__curbrk; /* Set the end of the process's data space to ADDR. Return 0 if successful, -1 if not. */ int -__brk (addr) - void *addr; +__brk (void *addr) { __set_errno (ENOSYS); return -1; diff --git a/misc/bug18240.c b/misc/bug18240.c new file mode 100644 index 0000000000..773586ee10 --- /dev/null +++ b/misc/bug18240.c @@ -0,0 +1,97 @@ +/* Test integer wraparound in hcreate. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <limits.h> +#include <search.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/resource.h> + +static void +test_size (size_t size) +{ + int res = hcreate (size); + if (res == 0) + { + if (errno == ENOMEM) + return; + printf ("error: hcreate (%zu): %m\n", size); + exit (1); + } + char *keys[100]; + for (int i = 0; i < 100; ++i) + { + if (asprintf (keys + i, "%d", i) < 0) + { + printf ("error: asprintf: %m\n"); + exit (1); + } + ENTRY e = { keys[i], (char *) "value" }; + if (hsearch (e, ENTER) == NULL) + { + printf ("error: hsearch (\"%s\"): %m\n", keys[i]); + exit (1); + } + } + hdestroy (); + + for (int i = 0; i < 100; ++i) + free (keys[i]); +} + +static int +do_test (void) +{ + /* Limit the size of the process, so that memory allocation will + fail without impacting the entire system. */ + { + struct rlimit limit; + if (getrlimit (RLIMIT_AS, &limit) != 0) + { + printf ("getrlimit (RLIMIT_AS) failed: %m\n"); + return 1; + } + long target = 100 * 1024 * 1024; + if (limit.rlim_cur == RLIM_INFINITY || limit.rlim_cur > target) + { + limit.rlim_cur = target; + if (setrlimit (RLIMIT_AS, &limit) != 0) + { + printf ("setrlimit (RLIMIT_AS) failed: %m\n"); + return 1; + } + } + } + + test_size (500); + test_size (-1); + test_size (-3); + test_size (INT_MAX - 2); + test_size (INT_MAX - 1); + test_size (INT_MAX); + test_size (((unsigned) INT_MAX) + 1); + test_size (UINT_MAX - 2); + test_size (UINT_MAX - 1); + test_size (UINT_MAX); + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/misc/chflags.c b/misc/chflags.c index 241be86be7..49c2fec851 100644 --- a/misc/chflags.c +++ b/misc/chflags.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,9 +24,7 @@ int chflags (const char *file, unsigned long int flags) __THROW; int -chflags (file, flags) - const char *file; - unsigned long int flags; +chflags (const char *file, unsigned long int flags) { if (file == NULL) { diff --git a/misc/chroot.c b/misc/chroot.c index 232a29f363..b863f3108f 100644 --- a/misc/chroot.c +++ b/misc/chroot.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,8 +21,7 @@ /* Make PATH be the root directory (the starting point for absolute paths). This call is restricted to the super-user. */ int -chroot (path) - const char *path; +chroot (const char *path) { __set_errno (ENOSYS); return -1; diff --git a/misc/daemon.c b/misc/daemon.c index 7597ce9996..9d186b24bd 100644 --- a/misc/daemon.c +++ b/misc/daemon.c @@ -41,8 +41,7 @@ static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93"; #include <not-cancel.h> int -daemon(nochdir, noclose) - int nochdir, noclose; +daemon (int nochdir, int noclose) { int fd; diff --git a/misc/dirname.c b/misc/dirname.c index 0ddae88865..a3dd52f2e8 100644 --- a/misc/dirname.c +++ b/misc/dirname.c @@ -1,5 +1,5 @@ /* dirname - return directory part of PATH. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/misc/efgcvt.c b/misc/efgcvt.c index 7c7939192b..c5b5f23558 100644 --- a/misc/efgcvt.c +++ b/misc/efgcvt.c @@ -1,5 +1,5 @@ /* Compatibility functions for floating point formatting. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,7 +21,7 @@ #include <stdlib.h> #include <sys/param.h> #include <float.h> -#include <bits/libc-lock.h> +#include <libc-lock.h> #include <math_ldbl_opt.h> #ifndef FLOAT_TYPE @@ -64,9 +64,8 @@ static char ECVT_BUFFER[MAXDIG]; libc_freeres_ptr (static char *FCVT_BUFPTR); char * -__APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign) - FLOAT_TYPE value; - int ndigit, *decpt, *sign; +__APPEND (FUNC_PREFIX, fcvt) (FLOAT_TYPE value, int ndigit, int *decpt, + int *sign) { if (FCVT_BUFPTR == NULL) { @@ -87,9 +86,8 @@ __APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign) char * -__APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign) - FLOAT_TYPE value; - int ndigit, *decpt, *sign; +__APPEND (FUNC_PREFIX, ecvt) (FLOAT_TYPE value, int ndigit, int *decpt, + int *sign) { (void) __APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, ECVT_BUFFER, MAXDIG); @@ -98,10 +96,7 @@ __APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign) } char * -__APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf) - FLOAT_TYPE value; - int ndigit; - char *buf; +__APPEND (FUNC_PREFIX, gcvt) (FLOAT_TYPE value, int ndigit, char *buf) { sprintf (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value); return buf; diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c index 2761222d87..a172760ecc 100644 --- a/misc/efgcvt_r.c +++ b/misc/efgcvt_r.c @@ -1,5 +1,5 @@ /* Compatibility functions for floating point formatting, reentrant versions. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -71,11 +71,8 @@ int -__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len) - FLOAT_TYPE value; - int ndigit, *decpt, *sign; - char *buf; - size_t len; +__APPEND (FUNC_PREFIX, fcvt_r) (FLOAT_TYPE value, int ndigit, int *decpt, + int *sign, char *buf, size_t len) { ssize_t n; ssize_t i; @@ -169,11 +166,8 @@ __APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len) } int -__APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len) - FLOAT_TYPE value; - int ndigit, *decpt, *sign; - char *buf; - size_t len; +__APPEND (FUNC_PREFIX, ecvt_r) (FLOAT_TYPE value, int ndigit, int *decpt, + int *sign, char *buf, size_t len) { int exponent = 0; diff --git a/misc/err.c b/misc/err.c index 7b98157d59..3067835a5d 100644 --- a/misc/err.c +++ b/misc/err.c @@ -1,5 +1,5 @@ /* 4.4BSD utility functions for error messages. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/err.h b/misc/err.h index 99e1cdd88e..b43fe68fea 100644 --- a/misc/err.h +++ b/misc/err.h @@ -1,5 +1,5 @@ /* 4.4BSD utility functions for error messages. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/error.c b/misc/error.c index aaa120d5ab..c4c0ae95fd 100644 --- a/misc/error.c +++ b/misc/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-2015 Free Software Foundation, Inc. + Copyright (C) 1990-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -85,7 +85,7 @@ extern void __error_at_line (int status, int errnum, const char *file_name, # undef putc # define putc(c, fp) _IO_putc (c, fp) -# include <bits/libc-lock.h> +# include <libc-lock.h> #else /* not _LIBC */ @@ -298,8 +298,8 @@ error (int status, int errnum, const char *message, ...) /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; - __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), - 0); + __libc_ptf_call (__pthread_setcancelstate, + (PTHREAD_CANCEL_DISABLE, &state), 0); #endif flush_stdout (); @@ -323,7 +323,7 @@ error (int status, int errnum, const char *message, ...) #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call - __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); + __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0); # endif #endif } @@ -360,7 +360,8 @@ error_at_line (int status, int errnum, const char *file_name, /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; - __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), + __libc_ptf_call (__pthread_setcancelstate, + (PTHREAD_CANCEL_DISABLE, &state), 0); #endif @@ -393,7 +394,7 @@ error_at_line (int status, int errnum, const char *file_name, #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call - __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); + __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0); # endif #endif } diff --git a/misc/error.h b/misc/error.h index 7356677c09..32d84ee92d 100644 --- a/misc/error.h +++ b/misc/error.h @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/fchflags.c b/misc/fchflags.c index b9f267583b..b3115f7660 100644 --- a/misc/fchflags.c +++ b/misc/fchflags.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,9 +24,7 @@ int fchflags (int fd, unsigned long int flags) __THROW; int -fchflags (fd, flags) - int fd; - unsigned long int flags; +fchflags (int fd, unsigned long int flags) { if (fd < 0) { diff --git a/misc/fdatasync.c b/misc/fdatasync.c index 60ebee1db3..8bc1ec38e3 100644 --- a/misc/fdatasync.c +++ b/misc/fdatasync.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/fgetxattr.c b/misc/fgetxattr.c index 360a990156..6ab1cc08b6 100644 --- a/misc/fgetxattr.c +++ b/misc/fgetxattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/flistxattr.c b/misc/flistxattr.c index 69562be0ed..22db5b44fd 100644 --- a/misc/flistxattr.c +++ b/misc/flistxattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/fremovexattr.c b/misc/fremovexattr.c index 7692319c0f..a51ef00988 100644 --- a/misc/fremovexattr.c +++ b/misc/fremovexattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/fsetxattr.c b/misc/fsetxattr.c index 500fe47d12..8a2a7a1a48 100644 --- a/misc/fsetxattr.c +++ b/misc/fsetxattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/fstab.c b/misc/fstab.c index 2d2e93216e..41b4874431 100644 --- a/misc/fstab.c +++ b/misc/fstab.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,7 +20,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <bits/libc-lock.h> +#include <libc-lock.h> #define BUFFER_SIZE 0x1fc0 @@ -61,8 +61,7 @@ getfsent (void) struct fstab * -getfsspec (name) - const char *name; +getfsspec (const char *name) { struct fstab_state *state; struct mntent *m; @@ -78,8 +77,7 @@ getfsspec (name) struct fstab * -getfsfile (name) - const char *name; +getfsfile (const char *name) { struct fstab_state *state; struct mntent *m; diff --git a/misc/fsync.c b/misc/fsync.c index 05f3acfc0a..a6f1901c1c 100644 --- a/misc/fsync.c +++ b/misc/fsync.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,7 @@ /* Make all changes done to FD actually appear on disk. */ int -fsync (fd) - int fd; +fsync (int fd) { __set_errno (ENOSYS); return -1; diff --git a/misc/ftruncate.c b/misc/ftruncate.c index 2d43c76a37..c64cad1dcb 100644 --- a/misc/ftruncate.c +++ b/misc/ftruncate.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ /* Truncate the file referenced by FD to LENGTH bytes. */ int -__ftruncate (fd, length) - int fd; - off_t length; +__ftruncate (int fd, off_t length) { __set_errno (ENOSYS); return -1; diff --git a/misc/ftruncate64.c b/misc/ftruncate64.c index 1c41fea5a5..8c5231410e 100644 --- a/misc/ftruncate64.c +++ b/misc/ftruncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2015 Free Software Foundation, Inc. +/* Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ /* Truncate the file referenced by FD to LENGTH bytes. */ int -__ftruncate64 (fd, length) - int fd; - off64_t length; +__ftruncate64 (int fd, off64_t length) { if ((off_t) length != length) { diff --git a/misc/futimes.c b/misc/futimes.c index 9459c3a8fb..88f28d4a6d 100644 --- a/misc/futimes.c +++ b/misc/futimes.c @@ -1,5 +1,5 @@ /* futimes -- change access and modification times of open file. Stub version. - Copyright (C) 2002-2015 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/futimesat.c b/misc/futimesat.c index c675aa5ef1..401b270d83 100644 --- a/misc/futimesat.c +++ b/misc/futimesat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2015 Free Software Foundation, Inc. +/* Copyright (C) 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,10 +24,7 @@ /* Change the access time of FILE relative to FD to TVP[0] and the modification time of FILE to TVP[1]. */ int -futimesat (fd, file, tvp) - int fd; - const char *file; - const struct timeval tvp[2]; +futimesat (int fd, const char *file, const struct timeval tvp[2]) { if (fd < 0 && (file == NULL diff --git a/misc/getauxval.c b/misc/getauxval.c index be41149936..e48f40f66d 100644 --- a/misc/getauxval.c +++ b/misc/getauxval.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2012-2015 Free Software Foundation, Inc. +/* Copyright (C) 2012-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/getclktck.c b/misc/getclktck.c index e16c120b03..c94f3ecef1 100644 --- a/misc/getclktck.c +++ b/misc/getclktck.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/getdomain.c b/misc/getdomain.c index c5ab3a5e5e..8f75cc6c8d 100644 --- a/misc/getdomain.c +++ b/misc/getdomain.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,9 +29,7 @@ /* The `uname' information includes the domain name. */ int -getdomainname (name, len) - char *name; - size_t len; +getdomainname (char *name, size_t len) { struct utsname u; size_t u_len; @@ -47,9 +45,7 @@ getdomainname (name, len) #else int -getdomainname (name, len) - char *name; - size_t len; +getdomainname (char *name, size_t len) { __set_errno (ENOSYS); return -1; diff --git a/misc/getdtsz.c b/misc/getdtsz.c index 182bb9e1e5..5398b79667 100644 --- a/misc/getdtsz.c +++ b/misc/getdtsz.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/gethostid.c b/misc/gethostid.c index 30b38f8ef0..70af0b09f7 100644 --- a/misc/gethostid.c +++ b/misc/gethostid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/gethostname.c b/misc/gethostname.c index 15097a80ce..f9a508a096 100644 --- a/misc/gethostname.c +++ b/misc/gethostname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,9 +22,7 @@ The result is null-terminated if LEN is large enough for the full name and the terminator. */ int -__gethostname (name, len) - char *name; - size_t len; +__gethostname (char *name, size_t len) { __set_errno (ENOSYS); return -1; diff --git a/misc/getloadavg.c b/misc/getloadavg.c index 5fad0e4cbf..9fa3440976 100644 --- a/misc/getloadavg.c +++ b/misc/getloadavg.c @@ -1,5 +1,5 @@ /* Get system load averages. Stub version. - Copyright (C) 1999-2015 Free Software Foundation, Inc. + Copyright (C) 1999-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/getpagesize.c b/misc/getpagesize.c index 93e86194ef..ea795c7742 100644 --- a/misc/getpagesize.c +++ b/misc/getpagesize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/getpass.c b/misc/getpass.c index dcaff3855c..7d34796da9 100644 --- a/misc/getpass.c +++ b/misc/getpass.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,7 +24,7 @@ #include <wchar.h> #define flockfile(s) _IO_flockfile (s) #define funlockfile(s) _IO_funlockfile (s) -#include <bits/libc-lock.h> +#include <libc-lock.h> /* It is desirable to use this bit on systems that have it. The only bit of terminal state we want to twiddle is echoing, which is @@ -43,8 +43,7 @@ call_fclose (void *arg) } char * -getpass (prompt) - const char *prompt; +getpass (const char *prompt) { FILE *in, *out; struct termios s, t; diff --git a/misc/getsysstats.c b/misc/getsysstats.c index d2dc86971c..048e407759 100644 --- a/misc/getsysstats.c +++ b/misc/getsysstats.c @@ -1,5 +1,5 @@ /* getsysstats - Determine various system internal values, stub version. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/misc/getttyent.c b/misc/getttyent.c index fcdbc2274c..d2af870123 100644 --- a/misc/getttyent.c +++ b/misc/getttyent.c @@ -142,8 +142,7 @@ weak_alias (__getttyent, getttyent) */ static char * internal_function -skip(p) - char *p; +skip (char *p) { char *t; int c, q; @@ -177,8 +176,7 @@ skip(p) static char * internal_function -value(p) - char *p; +value (char *p) { return ((p = index(p, '=')) ? ++p : NULL); diff --git a/misc/getxattr.c b/misc/getxattr.c index d90b192bd3..23c70030e2 100644 --- a/misc/getxattr.c +++ b/misc/getxattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/gtty.c b/misc/gtty.c index 9a64a9a0dc..2d88455575 100644 --- a/misc/gtty.c +++ b/misc/gtty.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ /* Fill in *PARAMS with terminal parameters associated with FD. */ int -gtty (fd, params) - int fd; - struct sgttyb *params; +gtty (int fd, struct sgttyb *params) { if (params == NULL) { diff --git a/misc/hsearch.c b/misc/hsearch.c index 7a0b0dc406..80ae881ecd 100644 --- a/misc/hsearch.c +++ b/misc/hsearch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> This file is part of the GNU C Library. @@ -24,9 +24,7 @@ static struct hsearch_data htab; /* Define the non-reentrant function using the reentrant counterparts. */ ENTRY * -hsearch (item, action) - ENTRY item; - ACTION action; +hsearch (ENTRY item, ACTION action) { ENTRY *result; @@ -37,8 +35,7 @@ hsearch (item, action) int -hcreate (nel) - size_t nel; +hcreate (size_t nel) { return __hcreate_r (nel, &htab); } diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c index 9f55e845cf..1fca6b3222 100644 --- a/misc/hsearch_r.c +++ b/misc/hsearch_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993. @@ -19,7 +19,7 @@ #include <errno.h> #include <malloc.h> #include <string.h> - +#include <stdint.h> #include <search.h> /* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986 @@ -46,15 +46,12 @@ static int isprime (unsigned int number) { /* no even number will be passed */ - unsigned int div = 3; - - while (div * div < number && number % div != 0) - div += 2; - - return number % div != 0; + for (unsigned int div = 3; div <= number / div; div += 2) + if (number % div == 0) + return 0; + return 1; } - /* Before using the hash table we must allocate memory for it. Test for an existing table are done. We allocate one element more as the found prime number says. This is done for more effective @@ -62,9 +59,7 @@ isprime (unsigned int number) The contents of the table is zeroed, especially the field used becomes zero. */ int -__hcreate_r (nel, htab) - size_t nel; - struct hsearch_data *htab; +__hcreate_r (size_t nel, struct hsearch_data *htab) { /* Test for correct arguments. */ if (htab == NULL) @@ -81,10 +76,19 @@ __hcreate_r (nel, htab) use will not work. */ if (nel < 3) nel = 3; - /* Change nel to the first prime number not smaller as nel. */ - nel |= 1; /* make odd */ - while (!isprime (nel)) - nel += 2; + + /* Change nel to the first prime number in the range [nel, UINT_MAX - 2], + The '- 2' means 'nel += 2' cannot overflow. */ + for (nel |= 1; ; nel += 2) + { + if (UINT_MAX - 2 < nel) + { + __set_errno (ENOMEM); + return 0; + } + if (isprime (nel)) + break; + } htab->size = nel; htab->filled = 0; @@ -104,8 +108,7 @@ weak_alias (__hcreate_r, hcreate_r) /* After using the hash table it has to be destroyed. The used memory can be freed and the local static variable can be marked as not used. */ void -__hdestroy_r (htab) - struct hsearch_data *htab; +__hdestroy_r (struct hsearch_data *htab) { /* Test for correct arguments. */ if (htab == NULL) @@ -138,11 +141,8 @@ weak_alias (__hdestroy_r, hdestroy_r) equality of the stored and the parameter value. This helps to prevent unnecessary expensive calls of strcmp. */ int -__hsearch_r (item, action, retval, htab) - ENTRY item; - ACTION action; - ENTRY **retval; - struct hsearch_data *htab; +__hsearch_r (ENTRY item, ACTION action, ENTRY **retval, + struct hsearch_data *htab) { unsigned int hval; unsigned int count; diff --git a/misc/ifunc-impl-list.c b/misc/ifunc-impl-list.c index 446c74f736..11a1becbd1 100644 --- a/misc/ifunc-impl-list.c +++ b/misc/ifunc-impl-list.c @@ -1,5 +1,5 @@ /* Enumerate available IFUNC implementations of a function. Stub version. - Copyright (C) 2012-2015 Free Software Foundation, Inc. + Copyright (C) 2012-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/init-misc.c b/misc/init-misc.c index 9254f02903..a9bf1da74a 100644 --- a/misc/init-misc.c +++ b/misc/init-misc.c @@ -1,5 +1,5 @@ /* Define and initialize `__progname' et. al. - Copyright (C) 1994-2015 Free Software Foundation, Inc. + Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/insremque.c b/misc/insremque.c index 3c56f514b6..cb435dc0df 100644 --- a/misc/insremque.c +++ b/misc/insremque.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/ioctl.c b/misc/ioctl.c index f75f3e41b2..a6ba0879e1 100644 --- a/misc/ioctl.c +++ b/misc/ioctl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ /* Perform the I/O control operation specified by REQUEST on FD. The actual type and use of ARG and the return value depend on REQUEST. */ int -__ioctl (fd, request) - int fd; - unsigned long int request; +__ioctl (int fd, unsigned long int request, ...) { __set_errno (ENOSYS); return -1; diff --git a/misc/lgetxattr.c b/misc/lgetxattr.c index f6e9a514d1..bddbfa3468 100644 --- a/misc/lgetxattr.c +++ b/misc/lgetxattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/libgen.h b/misc/libgen.h index 964a72f1b4..38f4d195d3 100644 --- a/misc/libgen.h +++ b/misc/libgen.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/listxattr.c b/misc/listxattr.c index a09565edbc..b5dafa57ba 100644 --- a/misc/listxattr.c +++ b/misc/listxattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/llistxattr.c b/misc/llistxattr.c index e9820760d1..7efcf91e85 100644 --- a/misc/llistxattr.c +++ b/misc/llistxattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/lremovexattr.c b/misc/lremovexattr.c index 85532817e1..6c48e69f07 100644 --- a/misc/lremovexattr.c +++ b/misc/lremovexattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/lsearch.c b/misc/lsearch.c index 08ade2b69f..3873638a1d 100644 --- a/misc/lsearch.c +++ b/misc/lsearch.c @@ -1,5 +1,5 @@ /* Linear search functions. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/misc/lsetxattr.c b/misc/lsetxattr.c index ea6bb7e5ce..28d10a094c 100644 --- a/misc/lsetxattr.c +++ b/misc/lsetxattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/lutimes.c b/misc/lutimes.c index 76d13bfef6..ed15db7108 100644 --- a/misc/lutimes.c +++ b/misc/lutimes.c @@ -1,5 +1,5 @@ /* lutimes -- change access and modification times of a symlink. Stub version. - Copyright (C) 2002-2015 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/madvise.c b/misc/madvise.c index 55f82d0491..91674bd769 100644 --- a/misc/madvise.c +++ b/misc/madvise.c @@ -1,5 +1,5 @@ /* Advise system about intentions for a memory region. Stub version. - Copyright (C) 1994-2015 Free Software Foundation, Inc. + Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/mincore.c b/misc/mincore.c index ea54670add..f01aa983a6 100644 --- a/misc/mincore.c +++ b/misc/mincore.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/mkdtemp.c b/misc/mkdtemp.c index 1f733cdfaa..34dde72d42 100644 --- a/misc/mkdtemp.c +++ b/misc/mkdtemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2015 Free Software Foundation, Inc. +/* Copyright (C) 1999-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,8 +24,7 @@ The directory is created, mode 700, and its name is returned. (This function comes from OpenBSD.) */ char * -mkdtemp (template) - char *template; +mkdtemp (char *template) { if (__gen_tempname (template, 0, 0, __GT_DIR)) return NULL; diff --git a/misc/mkostemp.c b/misc/mkostemp.c index 807e4770a0..c990bbd75b 100644 --- a/misc/mkostemp.c +++ b/misc/mkostemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,9 +27,7 @@ they are replaced with a string that makes the filename unique. Then open the file and return a fd. */ int -mkostemp (template, flags) - char *template; - int flags; +mkostemp (char *template, int flags) { return __gen_tempname (template, 0, flags, __GT_FILE); } diff --git a/misc/mkostemp64.c b/misc/mkostemp64.c index 2b9c868cd0..0c32c908e6 100644 --- a/misc/mkostemp64.c +++ b/misc/mkostemp64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,9 +27,7 @@ they are replaced with a string that makes the filename unique. Then open the file and return a fd. */ int -mkostemp64 (template, flags) - char *template; - int flags; +mkostemp64 (char *template, int flags) { return __gen_tempname (template, 0, flags | O_LARGEFILE, __GT_FILE); } diff --git a/misc/mkostemps.c b/misc/mkostemps.c index 892dc69ba2..fcc6053ef3 100644 --- a/misc/mkostemps.c +++ b/misc/mkostemps.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2015 Free Software Foundation, Inc. +/* Copyright (C) 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ "XXXXXX"; they are replaced with a string that makes the filename unique. Then open the file and return a fd. */ int -mkostemps (template, suffixlen, flags) - char *template; - int suffixlen; - int flags; +mkostemps (char *template, int suffixlen, int flags) { if (suffixlen < 0) { diff --git a/misc/mkostemps64.c b/misc/mkostemps64.c index 7b48b5c8c0..4351978d70 100644 --- a/misc/mkostemps64.c +++ b/misc/mkostemps64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ "XXXXXX"; they are replaced with a string that makes the filename unique. Then open the file and return a fd. */ int -mkostemps64 (template, suffixlen, flags) - char *template; - int suffixlen; - int flags; +mkostemps64 (char *template, int suffixlen, int flags) { if (suffixlen < 0) { diff --git a/misc/mkstemp.c b/misc/mkstemp.c index c5018d154a..69c6c00b79 100644 --- a/misc/mkstemp.c +++ b/misc/mkstemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,8 +27,7 @@ they are replaced with a string that makes the filename unique. Then open the file and return a fd. */ int -mkstemp (template) - char *template; +mkstemp (char *template) { return __gen_tempname (template, 0, 0, __GT_FILE); } diff --git a/misc/mkstemp64.c b/misc/mkstemp64.c index e4b8605950..b09c590850 100644 --- a/misc/mkstemp64.c +++ b/misc/mkstemp64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,8 +27,7 @@ they are replaced with a string that makes the filename unique. Then open the file and return a fd. */ int -mkstemp64 (template) - char *template; +mkstemp64 (char *template) { return __gen_tempname (template, 0, O_LARGEFILE, __GT_FILE); } diff --git a/misc/mkstemps.c b/misc/mkstemps.c index ca17d1d71a..1f46ef57fe 100644 --- a/misc/mkstemps.c +++ b/misc/mkstemps.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2015 Free Software Foundation, Inc. +/* Copyright (C) 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,9 +28,7 @@ "XXXXXX"; they are replaced with a string that makes the filename unique. Then open the file and return a fd. */ int -mkstemps (template, suffixlen) - char *template; - int suffixlen; +mkstemps (char *template, int suffixlen) { if (suffixlen < 0) { diff --git a/misc/mkstemps64.c b/misc/mkstemps64.c index dd786f13ab..93b7adbea3 100644 --- a/misc/mkstemps64.c +++ b/misc/mkstemps64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,9 +28,7 @@ "XXXXXX"; they are replaced with a string that makes the filename unique. Then open the file and return a fd. */ int -mkstemps64 (template, suffixlen) - char *template; - int suffixlen; +mkstemps64 (char *template, int suffixlen) { if (suffixlen < 0) { diff --git a/misc/mktemp.c b/misc/mktemp.c index fc82ede790..f14e10a0d3 100644 --- a/misc/mktemp.c +++ b/misc/mktemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,8 +22,7 @@ The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the filename unique. */ char * -__mktemp (template) - char *template; +__mktemp (char *template) { if (__gen_tempname (template, 0, 0, __GT_NOCREATE) < 0) /* We return the null string if we can't find a unique file name. */ @@ -33,4 +32,5 @@ __mktemp (template) } weak_alias (__mktemp, mktemp) -link_warning (mktemp, "the use of `mktemp' is dangerous, better use `mkstemp'") +link_warning (mktemp, "the use of `mktemp' is dangerous, " + "better use `mkstemp' or `mkdtemp'") diff --git a/misc/mlock.c b/misc/mlock.c index c84ca2e077..acca6dba2a 100644 --- a/misc/mlock.c +++ b/misc/mlock.c @@ -1,5 +1,5 @@ /* mlock -- guarantee pages are resident in memory. Stub version. - Copyright (C) 2001-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/mlockall.c b/misc/mlockall.c index be3e4f897d..62bc07ce46 100644 --- a/misc/mlockall.c +++ b/misc/mlockall.c @@ -1,5 +1,5 @@ /* mlockall -- lock in core all the pages in this process. Stub version. - Copyright (C) 2001-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/mmap.c b/misc/mmap.c index 9447067fcb..6e96cbbacd 100644 --- a/misc/mmap.c +++ b/misc/mmap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/mmap64.c b/misc/mmap64.c index 1797ed401b..8c0faa5e0d 100644 --- a/misc/mmap64.c +++ b/misc/mmap64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2015 Free Software Foundation, Inc. +/* Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/mntent.c b/misc/mntent.c index 7dedc62387..d1828bdc0f 100644 --- a/misc/mntent.c +++ b/misc/mntent.c @@ -1,5 +1,5 @@ /* Utilities for reading/writing fstab, mtab, etc. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ #include <mntent.h> #include <stdlib.h> -#include <bits/libc-lock.h> +#include <libc-lock.h> /* We don't want to allocate the static buffer all the time since it is not always used (in fact, rather infrequently). Accept the diff --git a/misc/mntent.h b/misc/mntent.h index cddb074ec6..43c083b146 100644 --- a/misc/mntent.h +++ b/misc/mntent.h @@ -1,5 +1,5 @@ /* Utilities for reading/writing fstab, mtab, etc. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/mntent_r.c b/misc/mntent_r.c index 615987347a..4ca42e6dbc 100644 --- a/misc/mntent_r.c +++ b/misc/mntent_r.c @@ -1,5 +1,5 @@ /* Utilities for reading/writing fstab, mtab, etc. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -136,7 +136,9 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz) end_ptr = strchr (buffer, '\n'); if (end_ptr != NULL) /* chop newline */ { - while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t') + /* Do not walk past the start of buffer if it's all whitespace. */ + while (end_ptr != buffer + && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')) end_ptr--; *end_ptr = '\0'; } diff --git a/misc/mprotect.c b/misc/mprotect.c index 64a72c4580..34251b0694 100644 --- a/misc/mprotect.c +++ b/misc/mprotect.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/msync.c b/misc/msync.c index 82589dd972..6db8ee8df5 100644 --- a/misc/msync.c +++ b/misc/msync.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/munlock.c b/misc/munlock.c index 50f3ae4b85..f6d1e160fd 100644 --- a/misc/munlock.c +++ b/misc/munlock.c @@ -1,5 +1,5 @@ /* munlock -- undo the effects of prior mlock calls. Stub version. - Copyright (C) 2001-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/munlockall.c b/misc/munlockall.c index 0c26450928..66ed33292d 100644 --- a/misc/munlockall.c +++ b/misc/munlockall.c @@ -1,5 +1,5 @@ /* munlockall -- undo the effects of all prior mlock calls. Stub version. - Copyright (C) 2001-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/munmap.c b/misc/munmap.c index 2f42b1aacb..d6d2d3ac10 100644 --- a/misc/munmap.c +++ b/misc/munmap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/preadv.c b/misc/preadv.c index 36296e3e98..7ecebdbedf 100644 --- a/misc/preadv.c +++ b/misc/preadv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2015 Free Software Foundation, Inc. +/* Copyright (C) 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,11 +26,7 @@ 'pread' (see <unistd.h>) except that data are put in VECTOR instead of a contiguous buffer. */ ssize_t -preadv (fd, vector, count, offset) - int fd; - const struct iovec *vector; - int count; - off_t offset; +preadv (int fd, const struct iovec *vector, int count, off_t offset) { __set_errno (ENOSYS); return -1; diff --git a/misc/preadv64.c b/misc/preadv64.c index d73ad87357..9326c92244 100644 --- a/misc/preadv64.c +++ b/misc/preadv64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2015 Free Software Foundation, Inc. +/* Copyright (C) 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,11 +26,7 @@ 'pread' (see <unistd.h>) except that data are put in VECTOR instead of a contiguous buffer. */ ssize_t -preadv64 (fd, vector, count, offset) - int fd; - const struct iovec *vector; - int count; - off64_t offset; +preadv64 (int fd, const struct iovec *vector, int count, off64_t offset) { __set_errno (ENOSYS); return -1; diff --git a/misc/pselect.c b/misc/pselect.c index 2f8d0a3edf..bfced60473 100644 --- a/misc/pselect.c +++ b/misc/pselect.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/misc/ptrace.c b/misc/ptrace.c index 095ad3fe18..1a97062e27 100644 --- a/misc/ptrace.c +++ b/misc/ptrace.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/pwritev.c b/misc/pwritev.c index 0b09809a48..405cad3bdd 100644 --- a/misc/pwritev.c +++ b/misc/pwritev.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2015 Free Software Foundation, Inc. +/* Copyright (C) 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,11 +26,7 @@ <unistd.h>) except that the data are taken from VECTOR instead of a contiguous buffer. */ ssize_t -pwritev (fd, vector, count, offset) - int fd; - const struct iovec *vector; - int count; - off_t offset; +pwritev (int fd, const struct iovec *vector, int count, off_t offset) { __set_errno (ENOSYS); return -1; diff --git a/misc/pwritev64.c b/misc/pwritev64.c index 8201b2c5f1..ce88f0e62d 100644 --- a/misc/pwritev64.c +++ b/misc/pwritev64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2015 Free Software Foundation, Inc. +/* Copyright (C) 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,11 +26,7 @@ <unistd.h>) except that the data are taken from VECTOR instead of a contiguous buffer. */ ssize_t -pwritev64 (fd, vector, count, offset) - int fd; - const struct iovec *vector; - int count; - off64_t offset; +pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset) { __set_errno (ENOSYS); return -1; diff --git a/misc/qefgcvt.c b/misc/qefgcvt.c index bc884a6686..6e082c28be 100644 --- a/misc/qefgcvt.c +++ b/misc/qefgcvt.c @@ -1,5 +1,5 @@ /* Compatibility functions for floating point formatting, long double version. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/qefgcvt_r.c b/misc/qefgcvt_r.c index 77a76280ff..0c0bc0d1f2 100644 --- a/misc/qefgcvt_r.c +++ b/misc/qefgcvt_r.c @@ -1,6 +1,6 @@ /* Compatibility functions for floating point formatting, reentrant, long double versions. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/readv.c b/misc/readv.c index de78708dc6..c0bdb0ebf0 100644 --- a/misc/readv.c +++ b/misc/readv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,10 +25,7 @@ Operates just like `read' (see <unistd.h>) except that data are put in VECTOR instead of a contiguous buffer. */ ssize_t -__readv (fd, vector, count) - int fd; - const struct iovec *vector; - int count; +__readv (int fd, const struct iovec *vector, int count) { __set_errno (ENOSYS); return -1; diff --git a/misc/reboot.c b/misc/reboot.c index de70662491..2391309876 100644 --- a/misc/reboot.c +++ b/misc/reboot.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/regexp.c b/misc/regexp.c index ee7d572111..3b3668272f 100644 --- a/misc/regexp.c +++ b/misc/regexp.c @@ -1,5 +1,5 @@ -/* Define function and variables for the obsolete <regexp.h> interface. - Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Compatibility symbols for the obsolete <regexp.h> interface. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -17,17 +17,27 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -/* We don't include regexp.h here because of the macros it requires, and - because it now contains an unconditional #warning. */ +/* regexp.h now contains only an #error directive, so it cannot be + used in this file. + + The function that would produce an 'expbuf' to use as the second + argument to 'step' and 'advance' was defined only in regexp.h, + as its definition depended on macros defined by the user. */ #include <regex.h> +#include <shlib-compat.h> + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23) /* Define the variables used for the interface. */ char *loc1; char *loc2; +compat_symbol (libc, loc1, loc1, GLIBC_2_0); +compat_symbol (libc, loc2, loc2, GLIBC_2_0); /* Although we do not support the use we define this variable as well. */ char *locs; +compat_symbol (libc, locs, locs, GLIBC_2_0); /* Find the next match in STRING. The compiled regular expression is @@ -35,7 +45,8 @@ char *locs; first character matched and `loc2' points to the next unmatched character. */ int -__step (const char *string, const char *expbuf) +weak_function attribute_compat_text_section +step (const char *string, const char *expbuf) { regmatch_t match; /* We only need info about the full match. */ @@ -50,14 +61,15 @@ __step (const char *string, const char *expbuf) loc2 = (char *) string + match.rm_eo; return 1; } -weak_alias (__step, step) +compat_symbol (libc, step, step, GLIBC_2_0); /* Match the beginning of STRING with the compiled regular expression in EXPBUF. If the match is successful `loc2' will contain the position of the first unmatched character. */ int -__advance (const char *string, const char *expbuf) +weak_function attribute_compat_text_section +advance (const char *string, const char *expbuf) { regmatch_t match; /* We only need info about the full match. */ @@ -74,4 +86,7 @@ __advance (const char *string, const char *expbuf) loc2 = (char *) string + match.rm_eo; return 1; } -weak_alias (__advance, advance) +compat_symbol (libc, advance, advance, GLIBC_2_0); + + +#endif /* SHLIB_COMPAT (2.0, 2.23) */ diff --git a/misc/regexp.h b/misc/regexp.h index 346098945d..6d3bc3075c 100644 --- a/misc/regexp.h +++ b/misc/regexp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -19,211 +19,15 @@ #ifndef _REGEXP_H #define _REGEXP_H 1 -/* The contents of this header file were standardized in the - Single Unix Specification, Version 2 (1997) but marked as - LEGACY; new applications were already being encouraged to - use <regex.h> instead. POSIX.1-2001 removed this header. +/* The contents of this header file were originally standardized in + the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994) + the header was marked as TO BE WITHDRAWN, and new applications + were encouraged to use <regex.h> instead. It was officially + withdrawn from the standard in Issue 6 (aka POSIX.1-2001). - This header is provided only for backward compatibility. - It will be removed in the next release of the GNU C Library. - New code should use <regex.h> instead. */ + The GNU C Library provided this header through version 2.22. */ -#warning "<regexp.h> will be removed in the next release of the GNU C Library." -#warning "Please update your code to use <regex.h> instead (no trailing 'p')." - -#include <features.h> -#include <alloca.h> -#include <regex.h> -#include <stdlib.h> -#include <string.h> - -/* The implementation provided here emulates the needed functionality - by mapping to the POSIX regular expression matcher. The interface - for the here included function is weird (this really is a harmless - word). - - The user has to provide six macros before this header file can be - included: - - INIT Declarations vor variables which can be used by the - other macros. - - GETC() Return the value of the next character in the regular - expression pattern. Successive calls should return - successive characters. - - PEEKC() Return the value of the next character in the regular - expression pattern. Immediately successive calls to - PEEKC() should return the same character which should - also be the next character returned by GETC(). - - UNGETC(c) Cause `c' to be returned by the next call to GETC() and - PEEKC(). - - RETURN(ptr) Used for normal exit of the `compile' function. `ptr' - is a pointer to the character after the last character of - the compiled regular expression. - - ERROR(val) Used for abnormal return from `compile'. `val' is the - error number. The error codes are: - 11 Range endpoint too large. - 16 Bad number. - 25 \digit out of range. - 36 Illegal or missing delimiter. - 41 No remembered search string. - 42 \( \) imbalance. - 43 Too many \(. - 44 More tan two numbers given in \{ \}. - 45 } expected after \. - 46 First number exceeds second in \{ \}. - 49 [ ] imbalance. - 50 Regular expression overflow. - - */ - -__BEGIN_DECLS - -/* Interface variables. They contain the results of the successful - calls to `setp' and `advance'. */ -extern char *loc1; -extern char *loc2; - -/* The use of this variable in the `advance' function is not - supported. */ -extern char *locs; - - -#ifndef __DO_NOT_DEFINE_COMPILE -/* Get and compile the user supplied pattern up to end of line or - string or until EOF is seen, whatever happens first. The result is - placed in the buffer starting at EXPBUF and delimited by ENDBUF. - - This function cannot be defined in the libc itself since it depends - on the macros. */ -char * -compile (char *__restrict instring, char *__restrict expbuf, - const char *__restrict endbuf, int eof) -{ - char *__input_buffer = NULL; - size_t __input_size = 0; - size_t __current_size = 0; - int __ch; - int __error; - INIT - - /* Align the expression buffer according to the needs for an object - of type `regex_t'. Then check for minimum size of the buffer for - the compiled regular expression. */ - regex_t *__expr_ptr; -# if defined __GNUC__ && __GNUC__ >= 2 - const size_t __req = __alignof__ (regex_t *); -# else - /* How shall we find out? We simply guess it and can change it is - this really proofs to be wrong. */ - const size_t __req = 8; -# endif - expbuf += __req; - expbuf -= (expbuf - ((char *) 0)) % __req; - if (endbuf < expbuf + sizeof (regex_t)) - { - ERROR (50); - } - __expr_ptr = (regex_t *) expbuf; - /* The remaining space in the buffer can be used for the compiled - pattern. */ - __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t); - __expr_ptr->__REPB_PREFIX (allocated) - = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer); - - while ((__ch = (GETC ())) != eof) - { - if (__ch == '\0' || __ch == '\n') - { - UNGETC (__ch); - break; - } - - if (__current_size + 1 >= __input_size) - { - size_t __new_size = __input_size ? 2 * __input_size : 128; - char *__new_room = (char *) alloca (__new_size); - /* See whether we can use the old buffer. */ - if (__new_room + __new_size == __input_buffer) - { - __input_size += __new_size; - __input_buffer = (char *) memcpy (__new_room, __input_buffer, - __current_size); - } - else if (__input_buffer + __input_size == __new_room) - __input_size += __new_size; - else - { - __input_size = __new_size; - __input_buffer = (char *) memcpy (__new_room, __input_buffer, - __current_size); - } - } - __input_buffer[__current_size++] = __ch; - } - if (__current_size) - __input_buffer[__current_size++] = '\0'; - else - __input_buffer = ""; - - /* Now compile the pattern. */ - __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE); - if (__error != 0) - /* Oh well, we have to translate POSIX error codes. */ - switch (__error) - { - case REG_BADPAT: - case REG_ECOLLATE: - case REG_ECTYPE: - case REG_EESCAPE: - case REG_BADRPT: - case REG_EEND: - case REG_ERPAREN: - default: - /* There is no matching error code. */ - ERROR (36); - case REG_ESUBREG: - ERROR (25); - case REG_EBRACK: - ERROR (49); - case REG_EPAREN: - ERROR (42); - case REG_EBRACE: - ERROR (44); - case REG_BADBR: - ERROR (46); - case REG_ERANGE: - ERROR (11); - case REG_ESPACE: - case REG_ESIZE: - ERROR (50); - } - - /* Everything is ok. */ - RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer) - + __expr_ptr->__REPB_PREFIX (used))); -} -#endif - - -/* Find the next match in STRING. The compiled regular expression is - found in the buffer starting at EXPBUF. `loc1' will return the - first character matched and `loc2' points to the next unmatched - character. */ -extern int step (const char *__restrict __string, - const char *__restrict __expbuf) __THROW; - -/* Match the beginning of STRING with the compiled regular expression - in EXPBUF. If the match is successful `loc2' will contain the - position of the first unmatched character. */ -extern int advance (const char *__restrict __string, - const char *__restrict __expbuf) __THROW; - - -__END_DECLS +#error "The GNU C Library no longer implements <regexp.h>." +#error "Please update your code to use <regex.h> instead (no trailing 'p')." #endif /* regexp.h */ diff --git a/misc/remap_file_pages.c b/misc/remap_file_pages.c index 6440726e8e..7c2352ebb7 100644 --- a/misc/remap_file_pages.c +++ b/misc/remap_file_pages.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2015 Free Software Foundation, Inc. +/* Copyright (C) 2003-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/removexattr.c b/misc/removexattr.c index 26bfb0b58a..3d18a92079 100644 --- a/misc/removexattr.c +++ b/misc/removexattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/revoke.c b/misc/revoke.c index 2baf5d6911..2c395e9639 100644 --- a/misc/revoke.c +++ b/misc/revoke.c @@ -1,5 +1,5 @@ /* Revoke the access of all descriptors currently open on a file. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,7 @@ #include <errno.h> int -revoke (file) - const char *file; +revoke (const char *file) { __set_errno (ENOSYS); return -1; diff --git a/misc/sbrk.c b/misc/sbrk.c index 89ab9c4a8c..4948dbfce6 100644 --- a/misc/sbrk.c +++ b/misc/sbrk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/search.h b/misc/search.h index 60e37463e8..bbf4b1d325 100644 --- a/misc/search.h +++ b/misc/search.h @@ -1,5 +1,5 @@ /* Declarations for System V style searching functions. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/select.c b/misc/select.c index e5cd18e4e0..320afb848f 100644 --- a/misc/select.c +++ b/misc/select.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,12 +25,8 @@ after waiting the interval specified therein. Returns the number of ready descriptors, or -1 for errors. */ int -__select (nfds, readfds, writefds, exceptfds, timeout) - int nfds; - fd_set *readfds; - fd_set *writefds; - fd_set *exceptfds; - struct timeval *timeout; +__select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + struct timeval *timeout) { __set_errno (ENOSYS); return -1; diff --git a/misc/setdomain.c b/misc/setdomain.c index 3cc03b1a1c..e4053c07ec 100644 --- a/misc/setdomain.c +++ b/misc/setdomain.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ /* Set the name of the current YP domain to NAME, which is LEN bytes long. This call is restricted to the super-user. */ int -setdomainname (name, len) - const char *name; - size_t len; +setdomainname (const char *name, size_t len) { __set_errno (ENOSYS); return -1; diff --git a/misc/setegid.c b/misc/setegid.c index 37a3b6ac63..81fe42c9f9 100644 --- a/misc/setegid.c +++ b/misc/setegid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,7 @@ /* Set the effective group ID of the calling process to GID. */ int -setegid (gid) - __gid_t gid; +setegid (__gid_t gid) { __set_errno (ENOSYS); return -1; diff --git a/misc/seteuid.c b/misc/seteuid.c index af92bcdb8c..e6c53b6882 100644 --- a/misc/seteuid.c +++ b/misc/seteuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,7 @@ /* Set the effective user ID of the calling process to UID. */ int -seteuid (uid) - __uid_t uid; +seteuid (__uid_t uid) { __set_errno (ENOSYS); return -1; diff --git a/misc/sethostid.c b/misc/sethostid.c index 96c750ea75..0010012e94 100644 --- a/misc/sethostid.c +++ b/misc/sethostid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,8 +21,7 @@ /* Set the current machine's Internet number to ID. This call is restricted to the super-user. */ int -sethostid (id) - long int id; +sethostid (long int id) { __set_errno (ENOSYS); return -1; diff --git a/misc/sethostname.c b/misc/sethostname.c index c6c1440c7b..6fb15b4248 100644 --- a/misc/sethostname.c +++ b/misc/sethostname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ /* Set the name of the current host to NAME, which is LEN bytes long. This call is restricted to the super-user. */ int -sethostname (name, len) - const char *name; - size_t len; +sethostname (const char *name, size_t len) { __set_errno (ENOSYS); return -1; diff --git a/misc/setregid.c b/misc/setregid.c index 692bff0105..2f4f51a186 100644 --- a/misc/setregid.c +++ b/misc/setregid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,9 +22,7 @@ /* Set the real group ID of the calling process to RGID, and the effective group ID of the calling process to EGID. */ int -__setregid (effective_gid, real_gid) - gid_t effective_gid; - gid_t real_gid; +__setregid (gid_t effective_gid, gid_t real_gid) { __set_errno (ENOSYS); return -1; diff --git a/misc/setreuid.c b/misc/setreuid.c index a6290f0eeb..d7e35cf9c6 100644 --- a/misc/setreuid.c +++ b/misc/setreuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,9 +22,7 @@ /* Set the real user ID of the calling process to RUID, and the effective user ID of the calling process to EUID. */ int -__setreuid (effective_uid, real_uid) - uid_t effective_uid; - uid_t real_uid; +__setreuid (uid_t effective_uid, uid_t real_uid) { __set_errno (ENOSYS); return -1; diff --git a/misc/setxattr.c b/misc/setxattr.c index 148f78703b..09fe443dd9 100644 --- a/misc/setxattr.c +++ b/misc/setxattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sgtty.h b/misc/sgtty.h index ec08a7cfcc..121cd26638 100644 --- a/misc/sgtty.h +++ b/misc/sgtty.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sstk.c b/misc/sstk.c index 437deb173e..d7527be7e5 100644 --- a/misc/sstk.c +++ b/misc/sstk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,8 +23,7 @@ void *sstk (int increment) __THROW; void * -sstk (increment) - int increment; +sstk (int increment) { __set_errno (ENOSYS); return (void *) -1; diff --git a/misc/stty.c b/misc/stty.c index 0ce3e60e17..6d2687d1f3 100644 --- a/misc/stty.c +++ b/misc/stty.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ /* Set the terminal parameters associated with FD to *PARAMS. */ int -stty (fd, params) - int fd; - const struct sgttyb *params; +stty (int fd, const struct sgttyb *params) { if (params == NULL) { diff --git a/misc/swapoff.c b/misc/swapoff.c index c5ef7e2180..448033381f 100644 --- a/misc/swapoff.c +++ b/misc/swapoff.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2015 Free Software Foundation, Inc. +/* Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/swapon.c b/misc/swapon.c index aadb910a12..d05bdc53fb 100644 --- a/misc/swapon.c +++ b/misc/swapon.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sync.c b/misc/sync.c index 9e437e76a9..2bb75b6551 100644 --- a/misc/sync.c +++ b/misc/sync.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/syncfs.c b/misc/syncfs.c index e9460569af..f5b64cbaa7 100644 --- a/misc/syncfs.c +++ b/misc/syncfs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2015 Free Software Foundation, Inc. +/* Copyright (C) 2011-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/auxv.h b/misc/sys/auxv.h index 81b1918477..73d48916d7 100644 --- a/misc/sys/auxv.h +++ b/misc/sys/auxv.h @@ -1,5 +1,5 @@ /* Access to the auxiliary vector. - Copyright (C) 2012-2015 Free Software Foundation, Inc. + Copyright (C) 2012-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 99e94cce86..7fd41549db 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2015 Free Software Foundation, Inc. +/* Copyright (C) 1992-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/dir.h b/misc/sys/dir.h index 1ffcd2a338..73b04bf4c6 100644 --- a/misc/sys/dir.h +++ b/misc/sys/dir.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/file.h b/misc/sys/file.h index e55b39e11b..133e969dfc 100644 --- a/misc/sys/file.h +++ b/misc/sys/file.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/ioctl.h b/misc/sys/ioctl.h index b4bf0bd5f8..4bc5a1a976 100644 --- a/misc/sys/ioctl.h +++ b/misc/sys/ioctl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/mman.h b/misc/sys/mman.h index 56e31b718d..a7879eafd3 100644 --- a/misc/sys/mman.h +++ b/misc/sys/mman.h @@ -1,5 +1,5 @@ /* Definitions for BSD-style memory management. - Copyright (C) 1994-2015 Free Software Foundation, Inc. + Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/param.h b/misc/sys/param.h index 62b7ed26f4..7e0e331450 100644 --- a/misc/sys/param.h +++ b/misc/sys/param.h @@ -1,5 +1,5 @@ /* Compatibility header for old-style Unix parameters and limits. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,6 +50,9 @@ #if !defined NOFILE && defined OPEN_MAX # define NOFILE OPEN_MAX #endif +#if !defined MAXHOSTNAMELEN && defined HOST_NAME_MAX +# define MAXHOSTNAMELEN HOST_NAME_MAX +#endif #ifndef NCARGS # ifdef ARG_MAX # define NCARGS ARG_MAX diff --git a/misc/sys/select.h b/misc/sys/select.h index 313107dcb8..b852dac2d8 100644 --- a/misc/sys/select.h +++ b/misc/sys/select.h @@ -1,5 +1,5 @@ /* `fd_set' type and related macros, and `select'/`pselect' declarations. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/uio.h b/misc/sys/uio.h index 928f327de1..2c98077c57 100644 --- a/misc/sys/uio.h +++ b/misc/sys/uio.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/ustat.h b/misc/sys/ustat.h index 0b811a2762..b58a1def7c 100644 --- a/misc/sys/ustat.h +++ b/misc/sys/ustat.h @@ -1,5 +1,5 @@ /* Header describing obsolete `ustat' interface. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/sys/xattr.h b/misc/sys/xattr.h index 29ba1da6e4..0bdce5721f 100644 --- a/misc/sys/xattr.h +++ b/misc/sys/xattr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2015 Free Software Foundation, Inc. +/* Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/syscall.c b/misc/syscall.c index 7590ad3044..35eec2ab12 100644 --- a/misc/syscall.c +++ b/misc/syscall.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,8 +23,7 @@ This only makes sense in certain operating systems. */ long int -syscall (callno) - long int callno; +syscall (long int callno, ...) { __set_errno (ENOSYS); return -1; diff --git a/misc/syslog.c b/misc/syslog.c index 9dd4cde18c..6922ad685c 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -47,7 +47,7 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94"; #include <time.h> #include <unistd.h> #include <stdlib.h> -#include <bits/libc-lock.h> +#include <libc-lock.h> #include <signal.h> #include <locale.h> @@ -346,36 +346,9 @@ openlog_internal(const char *ident, int logstat, int logfac) (void)strncpy(SyslogAddr.sun_path, _PATH_LOG, sizeof(SyslogAddr.sun_path)); if (LogStat & LOG_NDELAY) { -#ifdef SOCK_CLOEXEC -# ifndef __ASSUME_SOCK_CLOEXEC - if (__have_sock_cloexec >= 0) { -# endif - LogFile = __socket(AF_UNIX, - LogType - | SOCK_CLOEXEC, 0); -# ifndef __ASSUME_SOCK_CLOEXEC - if (__have_sock_cloexec == 0) - __have_sock_cloexec - = ((LogFile != -1 - || errno != EINVAL) - ? 1 : -1); - } -# endif -#endif -#ifndef __ASSUME_SOCK_CLOEXEC -# ifdef SOCK_CLOEXEC - if (__have_sock_cloexec < 0) -# endif - LogFile = __socket(AF_UNIX, LogType, 0); -#endif - if (LogFile == -1) - return; -#ifndef __ASSUME_SOCK_CLOEXEC -# ifdef SOCK_CLOEXEC - if (__have_sock_cloexec < 0) -# endif - __fcntl(LogFile, F_SETFD, FD_CLOEXEC); -#endif + LogFile = __socket(AF_UNIX, LogType | SOCK_CLOEXEC, 0); + if (LogFile == -1) + return; } } if (LogFile != -1 && !connected) @@ -452,8 +425,7 @@ closelog (void) /* setlogmask -- set the log mask level */ int -setlogmask(pmask) - int pmask; +setlogmask (int pmask) { int omask; diff --git a/misc/truncate.c b/misc/truncate.c index 750f9553af..c79bec04af 100644 --- a/misc/truncate.c +++ b/misc/truncate.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,9 +20,7 @@ /* Truncate PATH to LENGTH bytes. */ int -__truncate (path, length) - const char *path; - off_t length; +__truncate (const char *path, off_t length) { __set_errno (ENOSYS); return -1; diff --git a/misc/truncate64.c b/misc/truncate64.c index d1bb4ade2e..c1e032aa3c 100644 --- a/misc/truncate64.c +++ b/misc/truncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2015 Free Software Foundation, Inc. +/* Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ /* Truncate PATH to LENGTH bytes. */ int -truncate64 (path, length) - const char *path; - off64_t length; +truncate64 (const char *path, off64_t length) { if ((off_t) length != length) { diff --git a/misc/tsearch.c b/misc/tsearch.c index 869dc9bec7..ffb89ec0f8 100644 --- a/misc/tsearch.c +++ b/misc/tsearch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>, 1997. @@ -301,10 +301,7 @@ weak_alias (__tsearch, tsearch) KEY is the key to be located, ROOTP is the address of tree root, COMPAR the ordering function. */ void * -__tfind (key, vrootp, compar) - const void *key; - void *const *vrootp; - __compar_fn_t compar; +__tfind (const void *key, void *const *vrootp, __compar_fn_t compar) { node *rootp = (node *) vrootp; diff --git a/misc/tst-dirname.c b/misc/tst-dirname.c index db08a8d40d..c6ae20d9c0 100644 --- a/misc/tst-dirname.c +++ b/misc/tst-dirname.c @@ -1,5 +1,5 @@ /* Test program for dirname function a la XPG. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/misc/tst-efgcvt.c b/misc/tst-efgcvt.c index 5083fec91e..b8a7ef20ad 100644 --- a/misc/tst-efgcvt.c +++ b/misc/tst-efgcvt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/tst-fdset.c b/misc/tst-fdset.c index 077e0dbb8f..861c31607e 100644 --- a/misc/tst-fdset.c +++ b/misc/tst-fdset.c @@ -1,5 +1,5 @@ /* Test FD* macros. - Copyright (C) 1997-2015 Free Software Foundation, Inc. + Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Robert Bihlmeyer <robbe@orcus.priv.at>. diff --git a/misc/tst-mntent-blank-corrupt.c b/misc/tst-mntent-blank-corrupt.c new file mode 100644 index 0000000000..9e33ea083a --- /dev/null +++ b/misc/tst-mntent-blank-corrupt.c @@ -0,0 +1,45 @@ +/* Make sure blank lines does not cause memory corruption BZ #18887. + + Copyright (C) 2009-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <mntent.h> +#include <stdio.h> +#include <string.h> + +/* Make sure blank lines don't trigger memory corruption. This doesn't happen + for all targets though, so it's a best effort test BZ #18887. */ +static int +do_test (void) +{ + FILE *fp; + + fp = tmpfile (); + fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp); + rewind (fp); + + /* The corruption happens here ... */ + getmntent (fp); + /* ... but trigers here. */ + endmntent (fp); + + /* If the test failed, we would crash, and not hit this point. */ + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/misc/tst-mntent-blank-passno.c b/misc/tst-mntent-blank-passno.c new file mode 100644 index 0000000000..1bc21faa64 --- /dev/null +++ b/misc/tst-mntent-blank-passno.c @@ -0,0 +1,53 @@ +/* Make sure trailing whitespace is handled properly BZ #17273. + + Copyright (C) 2009-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <mntent.h> +#include <stdio.h> +#include <string.h> + +/* Check entries to make sure trailing whitespace is ignored and we return the + correct passno value BZ #17273. */ +static int +do_test (void) +{ + int result = 0; + FILE *fp; + struct mntent *mnt; + + fp = tmpfile (); + fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp); + rewind (fp); + + mnt = getmntent (fp); + if (strcmp (mnt->mnt_fsname, "/foo dir") != 0 + || strcmp (mnt->mnt_dir, "/bar dir") != 0 + || strcmp (mnt->mnt_type, "auto") != 0 + || strcmp (mnt->mnt_opts, "bind") != 0 + || mnt->mnt_freq != 0 + || mnt->mnt_passno != 0) + { + puts ("Error while reading entry with trailing whitespaces"); + result = 1; + } + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c index 876c89f8ed..b6ad8afcc6 100644 --- a/misc/tst-mntent.c +++ b/misc/tst-mntent.c @@ -5,8 +5,8 @@ #include <string.h> -int -main (int argc, char *argv[]) +static int +do_test (void) { int result = 0; struct mntent mef; @@ -73,27 +73,10 @@ main (int argc, char *argv[]) puts ("Error while reading written entry back in"); result = 1; } - - /* Part III: Entry with whitespaces at the end of a line. */ - rewind (fp); - - fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp); - - rewind (fp); - - mnt = getmntent (fp); - - if (strcmp (mnt->mnt_fsname, "/foo dir") != 0 - || strcmp (mnt->mnt_dir, "/bar dir") != 0 - || strcmp (mnt->mnt_type, "auto") != 0 - || strcmp (mnt->mnt_opts, "bind") != 0 - || mnt->mnt_freq != 0 - || mnt->mnt_passno != 0) - { - puts ("Error while reading entry with trailing whitespaces"); - result = 1; - } } return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/misc/tst-tsearch.c b/misc/tst-tsearch.c index 70b6c339fc..01912460eb 100644 --- a/misc/tst-tsearch.c +++ b/misc/tst-tsearch.c @@ -1,5 +1,5 @@ /* Test program for tsearch et al. - Copyright (C) 1997-2015 Free Software Foundation, Inc. + Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -248,8 +248,8 @@ mangle_tree (enum order how, enum action what, void **root, int lag) } -int -main (int argc, char **argv) +static int +do_test (void) { int total_error = 0; static char state[8] = { 1, 2, 3, 4, 5, 6, 7, 8 }; @@ -350,3 +350,7 @@ main (int argc, char **argv) return total_error; } + +#define TIMEOUT 10 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/misc/ualarm.c b/misc/ualarm.c index c6b097270f..510198a56a 100644 --- a/misc/ualarm.c +++ b/misc/ualarm.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,9 +24,7 @@ Returns the number of microseconds remaining before the alarm. */ useconds_t -ualarm (value, interval) - useconds_t value; - useconds_t interval; +ualarm (useconds_t value, useconds_t interval) { __set_errno (ENOSYS); return -1; diff --git a/misc/usleep.c b/misc/usleep.c index a28b77c22b..2e61362526 100644 --- a/misc/usleep.c +++ b/misc/usleep.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,7 @@ /* Sleep USECONDS microseconds, or until a previously set timer goes off. */ int -usleep (useconds) - useconds_t useconds; +usleep (useconds_t useconds) { __set_errno (ENOSYS); return -1; diff --git a/misc/ustat.c b/misc/ustat.c index 1e84062b50..c460ef183f 100644 --- a/misc/ustat.c +++ b/misc/ustat.c @@ -1,5 +1,5 @@ /* Return info on filesystem. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ #include <sys/ustat.h> int -ustat (dev, ust) - dev_t dev; - struct ustat * ust; +ustat (dev_t dev, struct ustat *ust) { __set_errno (ENOSYS); return -1; diff --git a/misc/utimes.c b/misc/utimes.c index 6b969e7b50..62acd2cb96 100644 --- a/misc/utimes.c +++ b/misc/utimes.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,9 +22,7 @@ /* Change the access time of FILE to TVP[0] and the modification time of FILE to TVP[1]. */ int -__utimes (file, tvp) - const char *file; - const struct timeval tvp[2]; +__utimes (const char *file, const struct timeval tvp[2]) { if (file == NULL) { diff --git a/misc/vhangup.c b/misc/vhangup.c index 97825406c7..e0ed8ed9be 100644 --- a/misc/vhangup.c +++ b/misc/vhangup.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/misc/writev.c b/misc/writev.c index 34e7841584..3531d617e8 100644 --- a/misc/writev.c +++ b/misc/writev.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,10 +25,7 @@ Operates just like `write' (see <unistd.h>) except that the data are taken from VECTOR instead of a contiguous buffer. */ ssize_t -__writev (fd, vector, count) - int fd; - const struct iovec *vector; - int count; +__writev (int fd, const struct iovec *vector, int count) { __set_errno (ENOSYS); return -1; |