diff options
author | Marcin Borkowski <mbork@mbork.pl> | 2017-12-07 14:24:57 +0100 |
---|---|---|
committer | Marcin Borkowski <mbork@mbork.pl> | 2017-12-07 14:24:57 +0100 |
commit | 0e3c10ce34c84d24013a84a725c6275ad87b1530 (patch) | |
tree | c37c89b1087a00e4d4799e6f4123c48ffca30270 /lib | |
parent | ab5fc7c8215e1066449da4eb0e027f8250cc9f49 (diff) | |
parent | d4db37b283daffa0f8c942a5b526b6444edc34c5 (diff) | |
download | emacs-0e3c10ce34c84d24013a84a725c6275ad87b1530.tar.gz |
Merge branch 'master' into fix/bug-20871
Diffstat (limited to 'lib')
151 files changed, 1356 insertions, 630 deletions
diff --git a/lib/COPYING b/lib/COPYING index 94a9ed024d3..f288702d2fa 100644 --- a/lib/COPYING +++ b/lib/COPYING @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. +<https://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/lib/Makefile.in b/lib/Makefile.in index ee41ea3e55e..1f5b154f355 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -15,7 +15,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. srcdir = @srcdir@ VPATH = @srcdir@ diff --git a/lib/acl-errno-valid.c b/lib/acl-errno-valid.c index a633985663b..1e96974dd12 100644 --- a/lib/acl-errno-valid.c +++ b/lib/acl-errno-valid.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert. */ diff --git a/lib/acl-internal.c b/lib/acl-internal.c index 2a2dee947d3..63e6b6b997c 100644 --- a/lib/acl-internal.c +++ b/lib/acl-internal.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */ diff --git a/lib/acl-internal.h b/lib/acl-internal.h index e7bda0eadeb..ebd24217bb6 100644 --- a/lib/acl-internal.h +++ b/lib/acl-internal.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */ diff --git a/lib/acl.h b/lib/acl.h index b13370c5912..d3b048022e3 100644 --- a/lib/acl.h +++ b/lib/acl.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert. */ diff --git a/lib/acl_entries.c b/lib/acl_entries.c index 1df6a844dfe..c7efaefd52f 100644 --- a/lib/acl_entries.c +++ b/lib/acl_entries.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert and Andreas Gruenbacher. */ diff --git a/lib/alloca.in.h b/lib/alloca.in.h index c3dc38a5b94..1881e74f5dc 100644 --- a/lib/alloca.in.h +++ b/lib/alloca.in.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see - <http://www.gnu.org/licenses/>. + <https://www.gnu.org/licenses/>. */ /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H diff --git a/lib/allocator.h b/lib/allocator.h index 650f8e071ea..fc3d646aa54 100644 --- a/lib/allocator.h +++ b/lib/allocator.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -29,7 +29,7 @@ struct allocator /* Do not use GCC attributes such as __attribute__ ((malloc)) with the function types pointed at by these members, because these attributes do not work with pointers to functions. See - <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00007.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2011-04/msg00007.html>. */ /* Call ALLOCATE to allocate memory, like 'malloc'. On failure ALLOCATE should return NULL, though not necessarily set errno. When given diff --git a/lib/arg-nonnull.h b/lib/arg-nonnull.h index 1e62cc89827..61ee0712747 100644 --- a/lib/arg-nonnull.h +++ b/lib/arg-nonnull.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools that the values passed as arguments n, ..., m must be non-NULL pointers. diff --git a/lib/at-func.c b/lib/at-func.c index 9eaa9932fab..2a3e375e9a2 100644 --- a/lib/at-func.c +++ b/lib/at-func.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/binary-io.c b/lib/binary-io.c index a7558b20fd1..2cee469781c 100644 --- a/lib/binary-io.c +++ b/lib/binary-io.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/binary-io.h b/lib/binary-io.h index 9f1dde108eb..75adb33c918 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _BINARY_H #define _BINARY_H diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h index 5fc0663defa..32385a289c6 100644 --- a/lib/byteswap.in.h +++ b/lib/byteswap.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_BYTESWAP_H #define _GL_BYTESWAP_H diff --git a/lib/c++defs.h b/lib/c++defs.h index f03f3591c35..09dcd3e0687 100644 --- a/lib/c++defs.h +++ b/lib/c++defs.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H @@ -266,7 +266,7 @@ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) # define _GL_CXXALIASWARN_1(func,namespace) \ _GL_CXXALIASWARN_2 (func, namespace) -/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, +/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ # if !__OPTIMIZE__ # define _GL_CXXALIASWARN_2(func,namespace) \ @@ -294,7 +294,7 @@ GNULIB_NAMESPACE) # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) -/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, +/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ # if !__OPTIMIZE__ # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ diff --git a/lib/c-ctype.h b/lib/c-ctype.h index bcdba6b9962..9ad3c18d471 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h @@ -18,7 +18,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, see <http://www.gnu.org/licenses/>. */ +along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef C_CTYPE_H #define C_CTYPE_H diff --git a/lib/c-strcase.h b/lib/c-strcase.h index c82dab1dbe6..220d21d34ec 100644 --- a/lib/c-strcase.h +++ b/lib/c-strcase.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef C_STRCASE_H #define C_STRCASE_H diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c index 5bce873d7b2..b2880a2e6c7 100644 --- a/lib/c-strcasecmp.c +++ b/lib/c-strcasecmp.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c index ada62d70b7b..982e17915bc 100644 --- a/lib/c-strncasecmp.c +++ b/lib/c-strncasecmp.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 455e00efe00..e2af54f0984 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index 528a8289e56..d436c691eaa 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ diff --git a/lib/cloexec.c b/lib/cloexec.c new file mode 100644 index 00000000000..2b67a0102e7 --- /dev/null +++ b/lib/cloexec.c @@ -0,0 +1,83 @@ +/* cloexec.c - set or clear the close-on-exec descriptor flag + + Copyright (C) 1991, 2004-2006, 2009-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + + The code is taken from glibc/manual/llio.texi */ + +#include <config.h> + +#include "cloexec.h" + +#include <errno.h> +#include <fcntl.h> +#include <unistd.h> + +/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, + or clear the flag if VALUE is false. + Return 0 on success, or -1 on error with 'errno' set. + + Note that on MingW, this function does NOT protect DESC from being + inherited into spawned children. Instead, either use dup_cloexec + followed by closing the original DESC, or use interfaces such as + open or pipe2 that accept flags like O_CLOEXEC to create DESC + non-inheritable in the first place. */ + +int +set_cloexec_flag (int desc, bool value) +{ +#ifdef F_SETFD + + int flags = fcntl (desc, F_GETFD, 0); + + if (0 <= flags) + { + int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC); + + if (flags == newflags + || fcntl (desc, F_SETFD, newflags) != -1) + return 0; + } + + return -1; + +#else /* !F_SETFD */ + + /* Use dup2 to reject invalid file descriptors; the cloexec flag + will be unaffected. */ + if (desc < 0) + { + errno = EBADF; + return -1; + } + if (dup2 (desc, desc) < 0) + /* errno is EBADF here. */ + return -1; + + /* There is nothing we can do on this kind of platform. Punt. */ + return 0; +#endif /* !F_SETFD */ +} + + +/* Duplicates a file handle FD, while marking the copy to be closed + prior to exec or spawn. Returns -1 and sets errno if FD could not + be duplicated. */ + +int +dup_cloexec (int fd) +{ + return fcntl (fd, F_DUPFD_CLOEXEC, 0); +} diff --git a/lib/cloexec.h b/lib/cloexec.h new file mode 100644 index 00000000000..d937a406817 --- /dev/null +++ b/lib/cloexec.h @@ -0,0 +1,38 @@ +/* cloexec.c - set or clear the close-on-exec descriptor flag + + Copyright (C) 2004, 2009-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +*/ + +#include <stdbool.h> + +/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, + or clear the flag if VALUE is false. + Return 0 on success, or -1 on error with 'errno' set. + + Note that on MingW, this function does NOT protect DESC from being + inherited into spawned children. Instead, either use dup_cloexec + followed by closing the original DESC, or use interfaces such as + open or pipe2 that accept flags like O_CLOEXEC to create DESC + non-inheritable in the first place. */ + +int set_cloexec_flag (int desc, bool value); + +/* Duplicates a file handle FD, while marking the copy to be closed + prior to exec or spawn. Returns -1 and sets errno if FD could not + be duplicated. */ + +int dup_cloexec (int fd); diff --git a/lib/close-stream.c b/lib/close-stream.c index 96c126536cc..19707626fa2 100644 --- a/lib/close-stream.c +++ b/lib/close-stream.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/count-leading-zeros.h b/lib/count-leading-zeros.h index e197137e66e..c8b3dc05110 100644 --- a/lib/count-leading-zeros.h +++ b/lib/count-leading-zeros.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ @@ -70,7 +70,8 @@ _GL_INLINE_HEADER_BEGIN COUNT_LEADING_ZEROS_INLINE int count_leading_zeros_32 (unsigned int x) { - /* http://graphics.stanford.edu/~seander/bithacks.html */ + /* <https://github.com/gibsjose/BitHacks> + <http://www.fit.vutbr.cz/~ibarina/pub/bithacks.pdf> */ static const char de_Bruijn_lookup[32] = { 31, 22, 30, 21, 18, 10, 29, 2, 20, 17, 15, 13, 9, 6, 28, 1, 23, 19, 11, 3, 16, 14, 7, 24, 12, 4, 8, 25, 5, 26, 27, 0 diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h index fb5fb927ff4..1576b08481b 100644 --- a/lib/count-one-bits.h +++ b/lib/count-one-bits.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Ben Pfaff. */ diff --git a/lib/count-trailing-zeros.h b/lib/count-trailing-zeros.h index 4a0a109d991..9f9f07f5a0d 100644 --- a/lib/count-trailing-zeros.h +++ b/lib/count-trailing-zeros.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -68,7 +68,8 @@ _GL_INLINE_HEADER_BEGIN COUNT_TRAILING_ZEROS_INLINE int count_trailing_zeros_32 (unsigned int x) { - /* http://graphics.stanford.edu/~seander/bithacks.html */ + /* <https://github.com/gibsjose/BitHacks> + <http://www.fit.vutbr.cz/~ibarina/pub/bithacks.pdf> */ static const char de_Bruijn_lookup[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 diff --git a/lib/diffseq.h b/lib/diffseq.h index d7a374357c7..b6f9f6f9d19 100644 --- a/lib/diffseq.h +++ b/lib/diffseq.h @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* The basic idea is to consider two vectors as similar if, when @@ -279,6 +279,11 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal, continue; #ifdef USE_HEURISTIC + bool heuristic = ctxt->heuristic; +#else + bool heuristic = false; +#endif + /* Heuristic: check occasionally for a diagonal that has made lots of progress compared with the edit distance. If we have any such, find the one that has made the most progress and return it @@ -287,7 +292,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal, With this heuristic, for vectors with a constant small density of changes, the algorithm is linear in the vector size. */ - if (200 < c && big_snake && ctxt->heuristic) + if (200 < c && big_snake && heuristic) { { OFFSET best = 0; @@ -367,7 +372,6 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal, } } } -#endif /* USE_HEURISTIC */ /* Heuristic: if we've gone well beyond the call of duty, give up and report halfway between our best results so far. */ diff --git a/lib/dirent.in.h b/lib/dirent.in.h index f59178751b1..5b235731e04 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_DIRENT_H diff --git a/lib/dirfd.c b/lib/dirfd.c index 6b1a7b27443..7e38fabdac2 100644 --- a/lib/dirfd.c +++ b/lib/dirfd.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/lib/dosname.h b/lib/dosname.h index dd5c177725c..255d57e4d6b 100644 --- a/lib/dosname.h +++ b/lib/dosname.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. From Paul Eggert and Jim Meyering. */ diff --git a/lib/dtotimespec.c b/lib/dtotimespec.c index 3ca5a9cfd35..8f2e8150c9b 100644 --- a/lib/dtotimespec.c +++ b/lib/dtotimespec.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Paul Eggert */ diff --git a/lib/dup2.c b/lib/dup2.c index 002dc8c76cb..85c1a44401a 100644 --- a/lib/dup2.c +++ b/lib/dup2.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Paul Eggert */ @@ -88,7 +88,7 @@ ms_windows_dup2 (int fd, int desired_fd) } /* Wine 1.0.1 return 0 when desired_fd is negative but not -1: - http://bugs.winehq.org/show_bug.cgi?id=21289 */ + https://bugs.winehq.org/show_bug.cgi?id=21289 */ if (desired_fd < 0) { errno = EBADF; diff --git a/lib/errno.in.h b/lib/errno.in.h index 13194f9d291..aaf5fecd73b 100644 --- a/lib/errno.in.h +++ b/lib/errno.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_ERRNO_H diff --git a/lib/euidaccess.c b/lib/euidaccess.c index da2bda9be0c..298c4459477 100644 --- a/lib/euidaccess.c +++ b/lib/euidaccess.c @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by David MacKenzie and Torbjorn Granlund. Adapted for GNU C library by Roland McGrath. */ diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h index 065a78dbffa..f2269269c53 100644 --- a/lib/execinfo.in.h +++ b/lib/execinfo.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c new file mode 100644 index 00000000000..09093467769 --- /dev/null +++ b/lib/explicit_bzero.c @@ -0,0 +1,48 @@ +/* Erasure of sensitive data, generic implementation. + Copyright (C) 2016-2017 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 General Public + License as published by the Free Software Foundation; either + version 3 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 + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* An assembler implementation of explicit_bzero can be created as an + assembler alias of an optimized bzero implementation. + Architecture-specific implementations also need to define + __explicit_bzero_chk. */ + +#if !_LIBC +# include <config.h> +#endif + +#include <string.h> + +/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero + redirects to that. */ +#undef explicit_bzero + +/* Set LEN bytes of S to 0. The compiler will not delete a call to + this function, even if S is dead after the call. */ +void +explicit_bzero (void *s, size_t len) +{ +#ifdef HAVE_EXPLICIT_MEMSET + explicit_memset (s, 0, len); +#else + memset (s, '\0', len); +# ifdef __GNUC__ + /* Compiler barrier. */ + asm volatile ("" ::: "memory"); +# endif +#endif +} diff --git a/lib/faccessat.c b/lib/faccessat.c index f9458e83039..fa9235820dc 100644 --- a/lib/faccessat.c +++ b/lib/faccessat.c @@ -12,14 +12,35 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Eric Blake */ +/* If the user's config.h happens to include <unistd.h>, let it include only + the system's <unistd.h> here, so that orig_faccessat doesn't recurse to + rpl_faccessat. */ +#define _GL_INCLUDING_UNISTD_H #include <config.h> #include <unistd.h> +#include <errno.h> #include <fcntl.h> +#include <string.h> +#include <sys/stat.h> +#undef _GL_INCLUDING_UNISTD_H + +#if HAVE_FACCESSAT +static int +orig_faccessat (int fd, char const *name, int mode, int flag) +{ + return faccessat (fd, name, mode, flag); +} +#endif + +/* Write "unistd.h" here, not <unistd.h>, otherwise OSF/1 5.1 DTK cc + eliminates this include because of the preliminary #include <unistd.h> + above. */ +#include "unistd.h" #ifndef HAVE_ACCESS /* Mingw lacks access, but it also lacks real vs. effective ids, so @@ -28,6 +49,29 @@ # define access euidaccess #endif +#if HAVE_FACCESSAT + +int +rpl_faccessat (int fd, char const *file, int mode, int flag) +{ + int result = orig_faccessat (fd, file, mode, flag); + + if (result == 0 && file[strlen (file) - 1] == '/') + { + struct stat st; + result = fstatat (fd, file, &st, 0); + if (result == 0 && !S_ISDIR (st.st_mode)) + { + errno = ENOTDIR; + return -1; + } + } + + return result; +} + +#else /* !HAVE_FACCESSAT */ + /* Invoke access or euidaccess on file, FILE, using mode MODE, in the directory open on descriptor FD. If possible, do it without changing the working directory. Otherwise, resort to using save_cwd/fchdir, then @@ -36,10 +80,12 @@ Note that this implementation only supports AT_EACCESS, although some native versions also support AT_SYMLINK_NOFOLLOW. */ -#define AT_FUNC_NAME faccessat -#define AT_FUNC_F1 euidaccess -#define AT_FUNC_F2 access -#define AT_FUNC_USE_F1_COND AT_EACCESS -#define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag -#define AT_FUNC_POST_FILE_ARGS , mode -#include "at-func.c" +# define AT_FUNC_NAME faccessat +# define AT_FUNC_F1 euidaccess +# define AT_FUNC_F2 access +# define AT_FUNC_USE_F1_COND AT_EACCESS +# define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag +# define AT_FUNC_POST_FILE_ARGS , mode +# include "at-func.c" + +#endif diff --git a/lib/fcntl.c b/lib/fcntl.c index d4dd144e05d..91efd12c2ba 100644 --- a/lib/fcntl.c +++ b/lib/fcntl.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake <ebb9@byu.net>. */ diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 4a1d40af6df..00b270c958d 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Paul Eggert */ @@ -213,7 +213,10 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " #endif #ifndef O_CLOEXEC -# define O_CLOEXEC 0 +# define O_CLOEXEC 0x40000000 /* Try to not collide with system O_* flags. */ +# define GNULIB_defined_O_CLOEXEC 1 +#else +# define GNULIB_defined_O_CLOEXEC 0 #endif #ifndef O_DIRECT diff --git a/lib/fdatasync.c b/lib/fdatasync.c index 6875fa4c69c..25fd74049fb 100644 --- a/lib/fdatasync.c +++ b/lib/fdatasync.c @@ -13,7 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> diff --git a/lib/fdopendir.c b/lib/fdopendir.c index 03be92adc1f..7f72258598d 100644 --- a/lib/fdopendir.c +++ b/lib/fdopendir.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/filemode.c b/lib/filemode.c index d62f70bc9bd..c6cf1f3196c 100644 --- a/lib/filemode.c +++ b/lib/filemode.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/filemode.h b/lib/filemode.h index 5fbb79146d8..809bf7eb0fb 100644 --- a/lib/filemode.h +++ b/lib/filemode.h @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef FILEMODE_H_ diff --git a/lib/filevercmp.c b/lib/filevercmp.c index 0396867c7e5..4026097b38e 100644 --- a/lib/filevercmp.c +++ b/lib/filevercmp.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> #include "filevercmp.h" @@ -79,7 +79,7 @@ order (unsigned char c) specification can be found in the Debian Policy Manual in the section on the 'Version' control field. This version of the code implements that from s5.6.12 of Debian Policy v3.8.0.1 - http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version */ + https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version */ static int _GL_ATTRIBUTE_PURE verrevcmp (const char *s1, size_t s1_len, const char *s2, size_t s2_len) { diff --git a/lib/filevercmp.h b/lib/filevercmp.h index d6989911726..25cc6f624cd 100644 --- a/lib/filevercmp.h +++ b/lib/filevercmp.h @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef FILEVERCMP_H #define FILEVERCMP_H diff --git a/lib/flexmember.h b/lib/flexmember.h index c71ea651036..7e4f95d3c89 100644 --- a/lib/flexmember.h +++ b/lib/flexmember.h @@ -2,18 +2,21 @@ Copyright 2016-2017 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + This file is part of the GNU C Library. - This program is distributed in the hope that it will be useful, + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 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 General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. Written by Paul Eggert. */ diff --git a/lib/fpending.c b/lib/fpending.c index c9b77866858..5811a4a7475 100644 --- a/lib/fpending.c +++ b/lib/fpending.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ @@ -41,7 +41,7 @@ __fpending (FILE *fp) return fp->_ptr - fp->_buffer; #elif defined __minix /* Minix */ return fp_->_ptr - fp_->_buf; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */ return (fp_->_ptr ? fp_->_ptr - fp_->_base : 0); #elif defined __UCLIBC__ /* uClibc */ return (fp->__modeflags & __FLAG_WRITING ? fp->__bufpos - fp->__bufstart : 0); @@ -51,8 +51,6 @@ __fpending (FILE *fp) return fp->__bufp - fp->__buffer; #elif defined EPLAN9 /* Plan9 */ return fp->wp - fp->buf; -#elif defined __VMS /* VMS */ - return (*fp)->_ptr - (*fp)->_base; #else # error "Please port gnulib fpending.c to your platform!" return 1; diff --git a/lib/fpending.h b/lib/fpending.h index a901deee4b0..73c7d795c18 100644 --- a/lib/fpending.h +++ b/lib/fpending.h @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Jim Meyering. */ diff --git a/lib/fstatat.c b/lib/fstatat.c index 70799bebcd3..237e68c5da7 100644 --- a/lib/fstatat.c +++ b/lib/fstatat.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert and Jim Meyering. */ @@ -28,7 +28,7 @@ #include <sys/stat.h> #undef __need_system_sys_stat_h -#if HAVE_FSTATAT +#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG static int orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) { @@ -41,6 +41,8 @@ orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) above. */ #include "sys/stat.h" +#include "stat-time.h" + #include <errno.h> #include <fcntl.h> #include <string.h> @@ -51,6 +53,12 @@ orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) # define LSTAT_FOLLOWS_SLASHED_SYMLINK 0 # endif +static int +normal_fstatat (int fd, char const *file, struct stat *st, int flag) +{ + return stat_time_normalize (orig_fstatat (fd, file, st, flag), st); +} + /* fstatat should always follow symbolic links that end in /, but on Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified. Likewise, trailing slash on a non-directory should be an error. @@ -63,7 +71,7 @@ orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) int rpl_fstatat (int fd, char const *file, struct stat *st, int flag) { - int result = orig_fstatat (fd, file, st, flag); + int result = normal_fstatat (fd, file, st, flag); size_t len; if (LSTAT_FOLLOWS_SLASHED_SYMLINK || result != 0) @@ -79,7 +87,7 @@ rpl_fstatat (int fd, char const *file, struct stat *st, int flag) errno = ENOTDIR; return -1; } - result = orig_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW); + result = normal_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW); } /* Fix stat behavior. */ if (result == 0 && !S_ISDIR (st->st_mode) && file[len - 1] == '/') @@ -111,7 +119,7 @@ stat_func (char const *name, struct stat *st) # endif /* Replacement for Solaris' function by the same name. - <http://www.google.com/search?q=fstatat+site:docs.sun.com> + <https://www.google.com/search?q=fstatat+site:docs.oracle.com> First, try to simulate it via l?stat ("/proc/self/fd/FD/FILE"). Failing that, simulate it via save_cwd/fchdir/(stat|lstat)/restore_cwd. If either the save_cwd or the restore_cwd fails (relatively unlikely), diff --git a/lib/fsusage.c b/lib/fsusage.c new file mode 100644 index 00000000000..b670c0c43a1 --- /dev/null +++ b/lib/fsusage.c @@ -0,0 +1,287 @@ +/* fsusage.c -- return space usage of mounted file systems + + Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2017 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#include <config.h> + +#include "fsusage.h" + +#include <limits.h> +#include <sys/types.h> + +#if STAT_STATVFS || STAT_STATVFS64 /* POSIX 1003.1-2001 (and later) with XSI */ +# include <sys/statvfs.h> +#else +/* Don't include backward-compatibility files unless they're needed. + Eventually we'd like to remove all this cruft. */ +# include <fcntl.h> +# include <unistd.h> +# include <sys/stat.h> +#if HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif +#if HAVE_SYS_MOUNT_H +# include <sys/mount.h> +#endif +#if HAVE_SYS_VFS_H +# include <sys/vfs.h> +#endif +# if HAVE_SYS_FS_S5PARAM_H /* Fujitsu UXP/V */ +# include <sys/fs/s5param.h> +# endif +# if HAVE_SYS_STATFS_H +# include <sys/statfs.h> +# endif +# if HAVE_DUSTAT_H /* AIX PS/2 */ +# include <sys/dustat.h> +# endif +#endif + +/* Many space usage primitives use all 1 bits to denote a value that is + not applicable or unknown. Propagate this information by returning + a uintmax_t value that is all 1 bits if X is all 1 bits, even if X + is unsigned and narrower than uintmax_t. */ +#define PROPAGATE_ALL_ONES(x) \ + ((sizeof (x) < sizeof (uintmax_t) \ + && (~ (x) == (sizeof (x) < sizeof (int) \ + ? - (1 << (sizeof (x) * CHAR_BIT)) \ + : 0))) \ + ? UINTMAX_MAX : (uintmax_t) (x)) + +/* Extract the top bit of X as an uintmax_t value. */ +#define EXTRACT_TOP_BIT(x) ((x) \ + & ((uintmax_t) 1 << (sizeof (x) * CHAR_BIT - 1))) + +/* If a value is negative, many space usage primitives store it into an + integer variable by assignment, even if the variable's type is unsigned. + So, if a space usage variable X's top bit is set, convert X to the + uintmax_t value V such that (- (uintmax_t) V) is the negative of + the original value. If X's top bit is clear, just yield X. + Use PROPAGATE_TOP_BIT if the original value might be negative; + otherwise, use PROPAGATE_ALL_ONES. */ +#define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1)) + +#ifdef STAT_STATVFS +/* Return true if statvfs works. This is false for statvfs on systems + with GNU libc on Linux kernels before 2.6.36, which stats all + preceding entries in /proc/mounts; that makes df hang if even one + of the corresponding file systems is hard-mounted but not available. */ +# if ! (__linux__ && (__GLIBC__ || __UCLIBC__)) +/* The FRSIZE fallback is not required in this case. */ +# undef STAT_STATFS2_FRSIZE +static int statvfs_works (void) { return 1; } +# else +# include <string.h> /* for strverscmp */ +# include <sys/utsname.h> +# include <sys/statfs.h> +# define STAT_STATFS2_BSIZE 1 + +static int +statvfs_works (void) +{ + static int statvfs_works_cache = -1; + struct utsname name; + if (statvfs_works_cache < 0) + statvfs_works_cache = (uname (&name) == 0 + && 0 <= strverscmp (name.release, "2.6.36")); + return statvfs_works_cache; +} +# endif +#endif + + +/* Fill in the fields of FSP with information about space usage for + the file system on which FILE resides. + DISK is the device on which FILE is mounted, for space-getting + methods that need to know it. + Return 0 if successful, -1 if not. When returning -1, ensure that + ERRNO is either a system error value, or zero if DISK is NULL + on a system that requires a non-NULL value. */ +int +get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) +{ +#ifdef STAT_STATVFS /* POSIX, except pre-2.6.36 glibc/Linux */ + + if (statvfs_works ()) + { + struct statvfs vfsd; + + if (statvfs (file, &vfsd) < 0) + return -1; + + /* f_frsize isn't guaranteed to be supported. */ + fsp->fsu_blocksize = (vfsd.f_frsize + ? PROPAGATE_ALL_ONES (vfsd.f_frsize) + : PROPAGATE_ALL_ONES (vfsd.f_bsize)); + + fsp->fsu_blocks = PROPAGATE_ALL_ONES (vfsd.f_blocks); + fsp->fsu_bfree = PROPAGATE_ALL_ONES (vfsd.f_bfree); + fsp->fsu_bavail = PROPAGATE_TOP_BIT (vfsd.f_bavail); + fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (vfsd.f_bavail) != 0; + fsp->fsu_files = PROPAGATE_ALL_ONES (vfsd.f_files); + fsp->fsu_ffree = PROPAGATE_ALL_ONES (vfsd.f_ffree); + return 0; + } + +#endif + +#if defined STAT_STATVFS64 /* AIX */ + + struct statvfs64 fsd; + + if (statvfs64 (file, &fsd) < 0) + return -1; + + /* f_frsize isn't guaranteed to be supported. */ + fsp->fsu_blocksize = (fsd.f_frsize + ? PROPAGATE_ALL_ONES (fsd.f_frsize) + : PROPAGATE_ALL_ONES (fsd.f_bsize)); + +#elif defined STAT_STATFS2_FS_DATA /* Ultrix */ + + struct fs_data fsd; + + if (statfs (file, &fsd) != 1) + return -1; + + fsp->fsu_blocksize = 1024; + fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot); + fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree); + fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.fd_req.bfreen); + fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.fd_req.bfreen) != 0; + fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot); + fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree); + +#elif defined STAT_STATFS3_OSF1 /* OSF/1 */ + + struct statfs fsd; + + if (statfs (file, &fsd, sizeof (struct statfs)) != 0) + return -1; + + fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); + +#elif defined STAT_STATFS2_FRSIZE /* 2.6 < glibc/Linux < 2.6.36 */ + + struct statfs fsd; + + if (statfs (file, &fsd) < 0) + return -1; + + fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_frsize); + +#elif defined STAT_STATFS2_BSIZE /* glibc/Linux < 2.6, 4.3BSD, SunOS 4, \ + Mac OS X < 10.4, FreeBSD < 5.0, \ + NetBSD < 3.0, OpenBSD < 4.4 */ + + struct statfs fsd; + + if (statfs (file, &fsd) < 0) + return -1; + + fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize); + +# ifdef STATFS_TRUNCATES_BLOCK_COUNTS + + /* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the + struct statfs are truncated to 2GB. These conditions detect that + truncation, presumably without botching the 4.1.1 case, in which + the values are not truncated. The correct counts are stored in + undocumented spare fields. */ + if (fsd.f_blocks == 0x7fffffff / fsd.f_bsize && fsd.f_spare[0] > 0) + { + fsd.f_blocks = fsd.f_spare[0]; + fsd.f_bfree = fsd.f_spare[1]; + fsd.f_bavail = fsd.f_spare[2]; + } +# endif /* STATFS_TRUNCATES_BLOCK_COUNTS */ + +#elif defined STAT_STATFS2_FSIZE /* 4.4BSD and older NetBSD */ + + struct statfs fsd; + + if (statfs (file, &fsd) < 0) + return -1; + + fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); + +#elif defined STAT_STATFS4 /* SVR3, Dynix, old Irix, old AIX, \ + Dolphin */ + +# if !_AIX && !defined _SEQUENT_ && !defined DOLPHIN +# define f_bavail f_bfree +# endif + + struct statfs fsd; + + if (statfs (file, &fsd, sizeof fsd, 0) < 0) + return -1; + + /* Empirically, the block counts on most SVR3 and SVR3-derived + systems seem to always be in terms of 512-byte blocks, + no matter what value f_bsize has. */ +# if _AIX || defined _CRAY + fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize); +# else + fsp->fsu_blocksize = 512; +# endif + +#endif + +#if (defined STAT_STATVFS64 || defined STAT_STATFS3_OSF1 \ + || defined STAT_STATFS2_FRSIZE || defined STAT_STATFS2_BSIZE \ + || defined STAT_STATFS2_FSIZE || defined STAT_STATFS4) + + fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks); + fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.f_bfree); + fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.f_bavail); + fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.f_bavail) != 0; + fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.f_files); + fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree); + +#endif + + (void) disk; /* avoid argument-unused warning */ + return 0; +} + +#if defined _AIX && defined _I386 +/* AIX PS/2 does not supply statfs. */ + +int +statfs (char *file, struct statfs *fsb) +{ + struct stat stats; + struct dustat fsd; + + if (stat (file, &stats) != 0) + return -1; + if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd))) + return -1; + fsb->f_type = 0; + fsb->f_bsize = fsd.du_bsize; + fsb->f_blocks = fsd.du_fsize - fsd.du_isize; + fsb->f_bfree = fsd.du_tfree; + fsb->f_bavail = fsd.du_tfree; + fsb->f_files = (fsd.du_isize - 2) * fsd.du_inopb; + fsb->f_ffree = fsd.du_tinode; + fsb->f_fsid.val[0] = fsd.du_site; + fsb->f_fsid.val[1] = fsd.du_pckno; + return 0; +} + +#endif /* _AIX && _I386 */ diff --git a/lib/fsusage.h b/lib/fsusage.h new file mode 100644 index 00000000000..f78edc6a0cb --- /dev/null +++ b/lib/fsusage.h @@ -0,0 +1,40 @@ +/* fsusage.h -- declarations for file system space usage info + + Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2017 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Space usage statistics for a file system. Blocks are 512-byte. */ + +#if !defined FSUSAGE_H_ +# define FSUSAGE_H_ + +# include <stdint.h> +# include <stdbool.h> + +struct fs_usage +{ + uintmax_t fsu_blocksize; /* Size of a block. */ + uintmax_t fsu_blocks; /* Total blocks. */ + uintmax_t fsu_bfree; /* Free blocks available to superuser. */ + uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */ + bool fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */ + uintmax_t fsu_files; /* Total file nodes. */ + uintmax_t fsu_ffree; /* Free file nodes. */ +}; + +int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp); + +#endif diff --git a/lib/fsync.c b/lib/fsync.c index 5a4945ef2bf..c25f1db6575 100644 --- a/lib/fsync.c +++ b/lib/fsync.c @@ -2,8 +2,8 @@ cross-compilers like MinGW. This is derived from sqlite3 sources. - http://www.sqlite.org/cvstrac/rlog?f=sqlite/src/os_win.c - http://www.sqlite.org/copyright.html + https://www.sqlite.org/src/finfo?name=src/os_win.c + https://www.sqlite.org/copyright.html Written by Richard W.M. Jones <rjones.at.redhat.com> @@ -20,7 +20,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> #include <unistd.h> diff --git a/lib/ftoastr.c b/lib/ftoastr.c index f2434161db8..bcc79f03673 100644 --- a/lib/ftoastr.c +++ b/lib/ftoastr.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -108,7 +108,7 @@ FTOASTR (char *buf, size_t bufsize, int flags, int width, FLOAT x) Andrysco M, Jhala R, Lerner S. Printing floating-point numbers: a faster, always correct method. ACM SIGPLAN notices - POPL '16. 2016;51(1):555-67 <http://dx.doi.org/10.1145/2914770.2837654>; draft at - <http://cseweb.ucsd.edu/~lerner/papers/fp-printing-popl16.pdf>. */ + <https://cseweb.ucsd.edu/~lerner/papers/fp-printing-popl16.pdf>. */ PROMOTED_FLOAT promoted_x = x; char format[sizeof "%-+ 0*.*Lg"]; diff --git a/lib/ftoastr.h b/lib/ftoastr.h index 74a855ac21a..f73712c9415 100644 --- a/lib/ftoastr.h +++ b/lib/ftoastr.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -96,7 +96,7 @@ enum DIG digits. For why the "+ 1" is needed, see "Binary to Decimal Conversion" in David Goldberg's paper "What Every Computer Scientist Should Know About Floating-Point Arithmetic" - <http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html>. */ + <https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html>. */ # define _GL_FLOAT_PREC_BOUND(dig) \ (INT_BITS_STRLEN_BOUND ((dig) * _GL_FLOAT_DIG_BITS_BOUND) + 1) diff --git a/lib/get-permissions.c b/lib/get-permissions.c index dc77748af19..c54d71c1c56 100644 --- a/lib/get-permissions.c +++ b/lib/get-permissions.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */ diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c index c356cf4aa97..d0a5ecaf5d6 100644 --- a/lib/getdtablesize.c +++ b/lib/getdtablesize.c @@ -1,4 +1,4 @@ -/* getdtablesize() function for platforms that don't have it. +/* getdtablesize() function: Return maximum possible file descriptor value + 1. Copyright (C) 2008-2017 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/getgroups.c b/lib/getgroups.c index dce0f2d0034..52473a5a230 100644 --- a/lib/getgroups.c +++ b/lib/getgroups.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 0fe23bb9a59..5f2dfabb6fd 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -17,7 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Compile-time symbols that this file uses: diff --git a/lib/getopt-cdefs.in.h b/lib/getopt-cdefs.in.h index c71a4f11f64..83a18f9a75e 100644 --- a/lib/getopt-cdefs.in.h +++ b/lib/getopt-cdefs.in.h @@ -4,19 +4,19 @@ Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. - gnulib is free software; you can redistribute it and/or modify it + This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - gnulib is distributed in the hope that it will be useful, but + This file 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 General Public License for more details. You should have received a copy of the GNU General Public License along with gnulib; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _GETOPT_CDEFS_H #define _GETOPT_CDEFS_H 1 diff --git a/lib/getopt-core.h b/lib/getopt-core.h index d315891aefd..ec0734c7230 100644 --- a/lib/getopt-core.h +++ b/lib/getopt-core.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _GETOPT_CORE_H #define _GETOPT_CORE_H 1 diff --git a/lib/getopt-ext.h b/lib/getopt-ext.h index e4da22f54f5..4cdbfb0e7a5 100644 --- a/lib/getopt-ext.h +++ b/lib/getopt-ext.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _GETOPT_EXT_H #define _GETOPT_EXT_H 1 diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h index db5f15c22d7..02b2b5064d3 100644 --- a/lib/getopt-pfx-core.h +++ b/lib/getopt-pfx-core.h @@ -4,19 +4,19 @@ Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. - gnulib is free software; you can redistribute it and/or modify it + This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - gnulib is distributed in the hope that it will be useful, but + This file 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 General Public License for more details. You should have received a copy of the GNU General Public License along with gnulib; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _GETOPT_PFX_CORE_H #define _GETOPT_PFX_CORE_H 1 diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h index 91f4df1720f..75e6fd32fe0 100644 --- a/lib/getopt-pfx-ext.h +++ b/lib/getopt-pfx-ext.h @@ -4,19 +4,19 @@ Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. - gnulib is free software; you can redistribute it and/or modify it + This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - gnulib is distributed in the hope that it will be useful, but + This file 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 General Public License for more details. You should have received a copy of the GNU General Public License along with gnulib; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _GETOPT_PFX_EXT_H #define _GETOPT_PFX_EXT_H 1 diff --git a/lib/getopt.c b/lib/getopt.c index 9a2867db277..b0cc35bfb1b 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 4ce1eb485af..594ed8092a1 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -5,18 +5,18 @@ with the GNU C Library, which supplies a different version of this file. - gnulib is free software; you can redistribute it and/or modify it + This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - gnulib is distributed in the hope that it will be useful, but + This file 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 General Public License for more details. You should have received a copy of the GNU General Public - License along with gnulib; if not, see <http://www.gnu.org/licenses/>. */ + License along with gnulib; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_GETOPT_H diff --git a/lib/getopt1.c b/lib/getopt1.c index 2bc5926016a..d689f4ce67a 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/getopt_.h b/lib/getopt_.h deleted file mode 100644 index 7c77a1c8d4f..00000000000 --- a/lib/getopt_.h +++ /dev/null @@ -1,285 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2017 Free - Software Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef _GL_GETOPT_H - -#if __GNUC__ >= 3 -#pragma GCC system_header -#endif - - -/* The include_next requires a split double-inclusion guard. We must - also inform the replacement unistd.h to not recursively use - <getopt.h>; our definitions will be present soon enough. */ -#if HAVE_GETOPT_H -# define _GL_SYSTEM_GETOPT -# ifndef __GNUC__ -# include <next_getopt.h> -# else -# include_next <getopt.h> -# endif -# undef _GL_SYSTEM_GETOPT -#endif - -#ifndef _GL_GETOPT_H - -#ifndef __need_getopt -# define _GL_GETOPT_H 1 -#endif - -/* Standalone applications should #define __GETOPT_PREFIX to an - identifier that prefixes the external functions and variables - defined in this header. When this happens, include the - headers that might declare getopt so that they will not cause - confusion if included after this file (if the system had <getopt.h>, - we have already included it). Then systematically rename - identifiers so that they do not collide with the system functions - and variables. Renaming avoids problems with some compilers and - linkers. */ -#if defined __GETOPT_PREFIX && !defined __need_getopt -# if !HAVE_GETOPT_H -# define __need_system_stdlib_h -# include <stdlib.h> -# undef __need_system_stdlib_h -# include <stdio.h> -# include <unistd.h> -# endif -# undef __need_getopt -# undef getopt -# undef getopt_long -# undef getopt_long_only -# undef optarg -# undef opterr -# undef optind -# undef optopt -# undef option -# define __GETOPT_CONCAT(x, y) x ## y -# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) -# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) -# define getopt __GETOPT_ID (getopt) -# define getopt_long __GETOPT_ID (getopt_long) -# define getopt_long_only __GETOPT_ID (getopt_long_only) -# define optarg __GETOPT_ID (optarg) -# define opterr __GETOPT_ID (opterr) -# define optind __GETOPT_ID (optind) -# define optopt __GETOPT_ID (optopt) -# define option __GETOPT_ID (option) -# define _getopt_internal __GETOPT_ID (getopt_internal) -#endif - -/* Standalone applications get correct prototypes for getopt_long and - getopt_long_only; they declare "char **argv". libc uses prototypes - with "char *const *argv" that are incorrect because getopt_long and - getopt_long_only can permute argv; this is required for backward - compatibility (e.g., for LSB 2.0.1). - - This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt', - but it caused redefinition warnings if both unistd.h and getopt.h were - included, since unistd.h includes getopt.h having previously defined - __need_getopt. - - The only place where __getopt_argv_const is used is in definitions - of getopt_long and getopt_long_only below, but these are visible - only if __need_getopt is not defined, so it is quite safe to rewrite - the conditional as follows: -*/ -#if !defined __need_getopt -# if defined __GETOPT_PREFIX -# define __getopt_argv_const /* empty */ -# else -# define __getopt_argv_const const -# endif -#endif - -/* If __GNU_LIBRARY__ is not already defined, either we are being used - standalone, or this is the first header included in the source file. - If we are being used with glibc, we need to include <features.h>, but - that does not exist if we are standalone. So: if __GNU_LIBRARY__ is - not defined, include <ctype.h>, which will pull in <features.h> for us - if it's from glibc. (Why ctype.h? It's guaranteed to exist and it - doesn't flood the namespace with stuff the way some other headers do.) */ -#if !defined __GNU_LIBRARY__ -# include <ctype.h> -#endif - -#ifndef __THROW -# ifndef __GNUC_PREREQ -# define __GNUC_PREREQ(maj, min) (0) -# endif -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# else -# define __THROW -# endif -#endif - -/* The definition of _GL_ARG_NONNULL is copied here. */ -/* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2017 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools - that the values passed as arguments n, ..., m must be non-NULL pointers. - n = 1 stands for the first argument, n = 2 for the second argument etc. */ -#ifndef _GL_ARG_NONNULL -# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 -# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) -# else -# define _GL_ARG_NONNULL(params) -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from 'getopt' to the caller. - When 'getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when 'ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to 'getopt'. - - On entry to 'getopt', zero means this is the first call; initialize. - - When 'getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, 'optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message 'getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of 'struct option' terminated by an element containing a name which is - zero. - - The field 'has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field 'flag' is not NULL, it points to a variable that is set - to the value given in the field 'val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an 'int' to - a compiled-in constant, such as set a value from 'optarg', set the - option's 'flag' field to zero and its 'val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero 'flag' field, 'getopt' - returns the contents of the 'val' field. */ - -# if !GNULIB_defined_struct_option -struct option -{ - const char *name; - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; -# define GNULIB_defined_struct_option 1 -# endif - -/* Names for the values of the 'has_arg' field of 'struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, 'optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in 'optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU 'getopt'. - - The argument '--' causes premature termination of argument - scanning, explicitly telling 'getopt' that there are no more - options. - - If OPTS begins with '-', then non-option arguments are treated as - arguments to the option '\1'. This behavior is specific to the GNU - 'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in - the environment, then do not permute arguments. */ - -extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) - __THROW _GL_ARG_NONNULL ((2, 3)); - -#ifndef __need_getopt -extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, - const char *__shortopts, - const struct option *__longopts, int *__longind) - __THROW _GL_ARG_NONNULL ((2, 3)); -extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, - const char *__shortopts, - const struct option *__longopts, int *__longind) - __THROW _GL_ARG_NONNULL ((2, 3)); - -#endif - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* _GL_GETOPT_H */ -#endif /* _GL_GETOPT_H */ diff --git a/lib/getopt_int.h b/lib/getopt_int.h index a5562195123..e33856ce9b9 100644 --- a/lib/getopt_int.h +++ b/lib/getopt_int.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifndef _GETOPT_INT_H #define _GETOPT_INT_H 1 diff --git a/lib/gettext.h b/lib/gettext.h index e7520af252f..f6150be6523 100644 --- a/lib/gettext.h +++ b/lib/gettext.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 @@ -185,7 +185,8 @@ npgettext_aux (const char *domain, #include <string.h> #if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ - /* || __STDC_VERSION__ >= 199901L */ ) + /* || __STDC_VERSION__ == 199901L + || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ) # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 #else # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 diff --git a/lib/gettime.c b/lib/gettime.c index 4ae313e78ea..e5af26c9902 100644 --- a/lib/gettime.c +++ b/lib/gettime.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c index 8ae7622af31..a11b1830c4c 100644 --- a/lib/gettimeofday.c +++ b/lib/gettimeofday.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 509089e6391..a7b33ba34e8 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -13,7 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this file. If not, see <http://www.gnu.org/licenses/>. +# along with this file. If not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, # this file may be distributed as part of a program that @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=tzset --avoid=unsetenv --avoid=utime --avoid=utime-h --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 diffseq dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr minmax mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright utimens vla warnings +# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=tzset --avoid=unsetenv --avoid=utime --avoid=utime-h --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 d-type diffseq dtoastr dtotimespec dup2 environ execinfo explicit_bzero faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsusage fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr minmax mkostemp mktime nstrftime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strtoimax symlink sys_stat sys_time tempname time time_r time_rz timegm timer-time timespec-add timespec-sub unlocked-io update-copyright utimens vla warnings MOSTLYCLEANFILES += core *.stackdump @@ -125,6 +125,7 @@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_EXPLICIT_BZERO = @GNULIB_EXPLICIT_BZERO@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHMODAT = @GNULIB_FCHMODAT@ @@ -254,6 +255,7 @@ GNULIB_READ = @GNULIB_READ@ GNULIB_READDIR = @GNULIB_READDIR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ +GNULIB_REALLOCARRAY = @GNULIB_REALLOCARRAY@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ GNULIB_REALPATH = @GNULIB_REALPATH@ GNULIB_REMOVE = @GNULIB_REMOVE@ @@ -367,12 +369,14 @@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ +HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ +HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ @@ -390,6 +394,7 @@ HAVE_DPRINTF = @HAVE_DPRINTF@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHMODAT = @HAVE_FCHMODAT@ @@ -463,6 +468,7 @@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ +HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RENAMEAT = @HAVE_RENAMEAT@ HAVE_REWINDDIR = @HAVE_REWINDDIR@ @@ -544,8 +550,6 @@ LD_SWITCH_SYSTEM_TEMACS = @LD_SWITCH_SYSTEM_TEMACS@ LD_SWITCH_X_SITE = @LD_SWITCH_X_SITE@ LD_SWITCH_X_SITE_RPATH = @LD_SWITCH_X_SITE_RPATH@ LIBGIF = @LIBGIF@ -LIBGNUTLS3_CFLAGS = @LIBGNUTLS3_CFLAGS@ -LIBGNUTLS3_LIBS = @LIBGNUTLS3_LIBS@ LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@ LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ @@ -554,6 +558,7 @@ LIBGPM = @LIBGPM@ LIBHESIOD = @LIBHESIOD@ LIBINTL = @LIBINTL@ LIBJPEG = @LIBJPEG@ +LIBLCMS2 = @LIBLCMS2@ LIBMODULES = @LIBMODULES@ LIBOBJS = @LIBOBJS@ LIBOTF_CFLAGS = @LIBOTF_CFLAGS@ @@ -684,6 +689,7 @@ REPLACE_DIRFD = @REPLACE_DIRFD@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ +REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ @@ -898,14 +904,14 @@ gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c = @gl_GNULIB_ENABLED_6099e973 gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec = @gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec@ gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1 = @gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1@ gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36 = @gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36@ +gl_GNULIB_ENABLED_cloexec = @gl_GNULIB_ENABLED_cloexec@ gl_GNULIB_ENABLED_dirfd = @gl_GNULIB_ENABLED_dirfd@ gl_GNULIB_ENABLED_dosname = @gl_GNULIB_ENABLED_dosname@ gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@ gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@ gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@ -gl_GNULIB_ENABLED_secure_getenv = @gl_GNULIB_ENABLED_secure_getenv@ +gl_GNULIB_ENABLED_open = @gl_GNULIB_ENABLED_open@ gl_GNULIB_ENABLED_strtoll = @gl_GNULIB_ENABLED_strtoll@ -gl_GNULIB_ENABLED_tempname = @gl_GNULIB_ENABLED_tempname@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ @@ -1087,6 +1093,18 @@ EXTRA_DIST += careadlinkat.h endif ## end gnulib module careadlinkat +## begin gnulib module cloexec +ifeq (,$(OMIT_GNULIB_MODULE_cloexec)) + +ifneq (,$(gl_GNULIB_ENABLED_cloexec)) +libgnu_a_SOURCES += cloexec.c + +endif +EXTRA_DIST += cloexec.h + +endif +## end gnulib module cloexec + ## begin gnulib module close-stream ifeq (,$(OMIT_GNULIB_MODULE_close-stream)) @@ -1356,6 +1374,17 @@ EXTRA_libgnu_a_SOURCES += execinfo.c endif ## end gnulib module execinfo +## begin gnulib module explicit_bzero +ifeq (,$(OMIT_GNULIB_MODULE_explicit_bzero)) + + +EXTRA_DIST += explicit_bzero.c + +EXTRA_libgnu_a_SOURCES += explicit_bzero.c + +endif +## end gnulib module explicit_bzero + ## begin gnulib module faccessat ifeq (,$(OMIT_GNULIB_MODULE_faccessat)) @@ -1488,6 +1517,17 @@ EXTRA_libgnu_a_SOURCES += at-func.c fstatat.c endif ## end gnulib module fstatat +## begin gnulib module fsusage +ifeq (,$(OMIT_GNULIB_MODULE_fsusage)) + + +EXTRA_DIST += fsusage.c fsusage.h + +EXTRA_libgnu_a_SOURCES += fsusage.c + +endif +## end gnulib module fsusage + ## begin gnulib module fsync ifeq (,$(OMIT_GNULIB_MODULE_fsync)) @@ -1798,6 +1838,29 @@ EXTRA_libgnu_a_SOURCES += mktime.c endif ## end gnulib module mktime-internal +## begin gnulib module nstrftime +ifeq (,$(OMIT_GNULIB_MODULE_nstrftime)) + +libgnu_a_SOURCES += nstrftime.c + +EXTRA_DIST += strftime.h + +endif +## end gnulib module nstrftime + +## begin gnulib module open +ifeq (,$(OMIT_GNULIB_MODULE_open)) + +ifneq (,$(gl_GNULIB_ENABLED_open)) + +endif +EXTRA_DIST += open.c + +EXTRA_libgnu_a_SOURCES += open.c + +endif +## end gnulib module open + ## begin gnulib module openat-h ifeq (,$(OMIT_GNULIB_MODULE_openat-h)) @@ -1891,19 +1954,6 @@ EXTRA_DIST += root-uid.h endif ## end gnulib module root-uid -## begin gnulib module secure_getenv -ifeq (,$(OMIT_GNULIB_MODULE_secure_getenv)) - -ifneq (,$(gl_GNULIB_ENABLED_secure_getenv)) - -endif -EXTRA_DIST += secure_getenv.c - -EXTRA_libgnu_a_SOURCES += secure_getenv.c - -endif -## end gnulib module secure_getenv - ## begin gnulib module sig2str ifeq (,$(OMIT_GNULIB_MODULE_sig2str)) @@ -2305,6 +2355,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \ -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ @@ -2323,6 +2374,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \ + -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ @@ -2335,10 +2387,12 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ + -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ + -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ @@ -2386,16 +2440,6 @@ EXTRA_libgnu_a_SOURCES += stpcpy.c endif ## end gnulib module stpcpy -## begin gnulib module strftime -ifeq (,$(OMIT_GNULIB_MODULE_strftime)) - -libgnu_a_SOURCES += strftime.c - -EXTRA_DIST += strftime.h - -endif -## end gnulib module strftime - ## begin gnulib module string ifeq (,$(OMIT_GNULIB_MODULE_string)) @@ -2411,6 +2455,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GNULIB_EXPLICIT_BZERO)/g' \ -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ @@ -2449,7 +2494,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ - sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ + -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ @@ -2470,20 +2516,20 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ - -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ - -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ - -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ - -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ - -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ - -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ @@ -2702,10 +2748,8 @@ endif ## begin gnulib module tempname ifeq (,$(OMIT_GNULIB_MODULE_tempname)) -ifneq (,$(gl_GNULIB_ENABLED_tempname)) libgnu_a_SOURCES += tempname.c -endif EXTRA_DIST += tempname.h endif @@ -2954,6 +2998,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ + -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ @@ -2996,6 +3041,15 @@ EXTRA_DIST += unistd.in.h endif ## end gnulib module unistd +## begin gnulib module unlocked-io +ifeq (,$(OMIT_GNULIB_MODULE_unlocked-io)) + + +EXTRA_DIST += unlocked-io.h + +endif +## end gnulib module unlocked-io + ## begin gnulib module update-copyright ifeq (,$(OMIT_GNULIB_MODULE_update-copyright)) diff --git a/lib/group-member.c b/lib/group-member.c index 20f8ee8b67f..7c4ce496753 100644 --- a/lib/group-member.c +++ b/lib/group-member.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/ignore-value.h b/lib/ignore-value.h index 2439d9506a7..8ef3fe782f7 100644 --- a/lib/ignore-value.h +++ b/lib/ignore-value.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering, Eric Blake and Pádraig Brady. */ diff --git a/lib/intprops.h b/lib/intprops.h index 28f43613fe2..2df7b1f9f69 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -26,7 +26,7 @@ #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) /* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see - <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>. */ #define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v)) /* The extra casts in the following macros work around compiler bugs, @@ -179,7 +179,7 @@ /* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. See above for restrictions. Avoid && and || as they tickle bugs in Sun C 5.11 2010/08/13 and other compilers; see - <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>. */ #define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ ((b) < 0 \ ? ((a) < 0 \ @@ -443,7 +443,7 @@ implementation-defined result or signal for values outside T's range. However, code that works around this theoretical problem runs afoul of a compiler bug in Oracle Studio 12.3 x86. See: - http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00049.html + https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html As the compiler bug is real, don't try to work around the theoretical problem. */ diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index 69b12a839a8..e7357e96acc 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* * ISO C 99 <inttypes.h> for platforms that lack it. diff --git a/lib/limits.in.h b/lib/limits.in.h index 08d3c328c4a..78dcf31037e 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_LIMITS_H diff --git a/lib/localtime-buffer.c b/lib/localtime-buffer.c index f84ad3e8238..c96c577ac1f 100644 --- a/lib/localtime-buffer.c +++ b/lib/localtime-buffer.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/localtime-buffer.h b/lib/localtime-buffer.h index 483a579bda4..0a0389da073 100644 --- a/lib/localtime-buffer.h +++ b/lib/localtime-buffer.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/lstat.c b/lib/lstat.c index f4dc43ec642..f3c61779540 100644 --- a/lib/lstat.c +++ b/lib/lstat.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ @@ -47,6 +47,8 @@ orig_lstat (const char *filename, struct stat *buf) above. */ # include "sys/stat.h" +# include "stat-time.h" + # include <string.h> # include <errno.h> @@ -66,32 +68,33 @@ orig_lstat (const char *filename, struct stat *buf) int rpl_lstat (const char *file, struct stat *sbuf) { - size_t len; - int lstat_result = orig_lstat (file, sbuf); - - if (lstat_result != 0) - return lstat_result; + int result = orig_lstat (file, sbuf); /* This replacement file can blindly check against '/' rather than using the ISSLASH macro, because all platforms with '\\' either lack symlinks (mingw) or have working lstat (cygwin) and thus do not compile this file. 0 len should have already been filtered out above, with a failure return of ENOENT. */ - len = strlen (file); - if (file[len - 1] != '/' || S_ISDIR (sbuf->st_mode)) - return 0; - - /* At this point, a trailing slash is only permitted on - symlink-to-dir; but it should have found information on the - directory, not the symlink. Call stat() to get info about the - link's referent. Our replacement stat guarantees valid results, - even if the symlink is not pointing to a directory. */ - if (!S_ISLNK (sbuf->st_mode)) + if (result == 0) { - errno = ENOTDIR; - return -1; + if (S_ISDIR (sbuf->st_mode) || file[strlen (file) - 1] != '/') + result = stat_time_normalize (result, sbuf); + else + { + /* At this point, a trailing slash is permitted only on + symlink-to-dir; but it should have found information on the + directory, not the symlink. Call 'stat' to get info about the + link's referent. Our replacement stat guarantees valid results, + even if the symlink is not pointing to a directory. */ + if (!S_ISLNK (sbuf->st_mode)) + { + errno = ENOTDIR; + return -1; + } + result = stat (file, sbuf); + } } - return stat (file, sbuf); + return result; } #endif /* HAVE_LSTAT */ diff --git a/lib/md5.c b/lib/md5.c index dcbba45ddff..e16da5990f3 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ diff --git a/lib/md5.h b/lib/md5.h index e38a6198708..8b94bfcf0e0 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MD5_H #define _MD5_H 1 diff --git a/lib/memrchr.c b/lib/memrchr.c index fefe16cc517..29e56984cb1 100644 --- a/lib/memrchr.c +++ b/lib/memrchr.c @@ -20,7 +20,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if defined _LIBC # include <memcopy.h> diff --git a/lib/minmax.h b/lib/minmax.h index 6b602a94fdb..bbf14163c1b 100644 --- a/lib/minmax.h +++ b/lib/minmax.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MINMAX_H #define _MINMAX_H diff --git a/lib/mkostemp.c b/lib/mkostemp.c index 56c22a4464c..f1ce93babea 100644 --- a/lib/mkostemp.c +++ b/lib/mkostemp.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if !_LIBC # include <config.h> diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h index 6c8b2e7f526..00e58abdd6c 100644 --- a/lib/mktime-internal.h +++ b/lib/mktime-internal.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <time.h> diff --git a/lib/mktime.c b/lib/mktime.c index 058ab65c03e..dd7f0a3ab34 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ /* Define this to 1 to have a standalone program to test this implementation of mktime. */ diff --git a/lib/strftime.c b/lib/nstrftime.c index 99bee4ef978..8795cd729d7 100644 --- a/lib/strftime.c +++ b/lib/nstrftime.c @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #ifdef _LIBC # define USE_IN_EXTENDED_LOCALE_MODEL 1 diff --git a/lib/open.c b/lib/open.c new file mode 100644 index 00000000000..b5452b56afd --- /dev/null +++ b/lib/open.c @@ -0,0 +1,208 @@ +/* Open a descriptor to a file. + Copyright (C) 2007-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ + +/* If the user's config.h happens to include <fcntl.h>, let it include only + the system's <fcntl.h> here, so that orig_open doesn't recurse to + rpl_open. */ +#define __need_system_fcntl_h +#include <config.h> + +/* Get the original definition of open. It might be defined as a macro. */ +#include <fcntl.h> +#include <sys/types.h> +#undef __need_system_fcntl_h + +static int +orig_open (const char *filename, int flags, mode_t mode) +{ + return open (filename, flags, mode); +} + +/* Specification. */ +/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates + this include because of the preliminary #include <fcntl.h> above. */ +#include "fcntl.h" + +#include "cloexec.h" + +#include <errno.h> +#include <stdarg.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +#ifndef REPLACE_OPEN_DIRECTORY +# define REPLACE_OPEN_DIRECTORY 0 +#endif + +int +open (const char *filename, int flags, ...) +{ + /* 0 = unknown, 1 = yes, -1 = no. */ +#if GNULIB_defined_O_CLOEXEC + int have_cloexec = -1; +#else + static int have_cloexec; +#endif + + mode_t mode; + int fd; + + mode = 0; + if (flags & O_CREAT) + { + va_list arg; + va_start (arg, flags); + + /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 + creates crashing code when 'mode_t' is smaller than 'int'. */ + mode = va_arg (arg, PROMOTED_MODE_T); + + va_end (arg); + } + +#if GNULIB_defined_O_NONBLOCK + /* The only known platform that lacks O_NONBLOCK is mingw, but it + also lacks named pipes and Unix sockets, which are the only two + file types that require non-blocking handling in open(). + Therefore, it is safe to ignore O_NONBLOCK here. It is handy + that mingw also lacks openat(), so that is also covered here. */ + flags &= ~O_NONBLOCK; +#endif + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + if (strcmp (filename, "/dev/null") == 0) + filename = "NUL"; +#endif + +#if OPEN_TRAILING_SLASH_BUG + /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR + is specified, then fail. + Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> + says that + "A pathname that contains at least one non-slash character and that + ends with one or more trailing slashes shall be resolved as if a + single dot character ( '.' ) were appended to the pathname." + and + "The special filename dot shall refer to the directory specified by + its predecessor." + If the named file already exists as a directory, then + - if O_CREAT is specified, open() must fail because of the semantics + of O_CREAT, + - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX + <http://www.opengroup.org/susv3/functions/open.html> says that it + fails with errno = EISDIR in this case. + If the named file does not exist or does not name a directory, then + - if O_CREAT is specified, open() must fail since open() cannot create + directories, + - if O_WRONLY or O_RDWR is specified, open() must fail because the + file does not contain a '.' directory. */ + if (flags & (O_CREAT | O_WRONLY | O_RDWR)) + { + size_t len = strlen (filename); + if (len > 0 && filename[len - 1] == '/') + { + errno = EISDIR; + return -1; + } + } +#endif + + fd = orig_open (filename, + flags & ~(have_cloexec <= 0 ? O_CLOEXEC : 0), mode); + + if (flags & O_CLOEXEC) + { + if (! have_cloexec) + { + if (0 <= fd) + have_cloexec = 1; + else if (errno == EINVAL) + { + fd = orig_open (filename, flags & ~O_CLOEXEC, mode); + have_cloexec = -1; + } + } + if (have_cloexec < 0 && 0 <= fd) + set_cloexec_flag (fd, true); + } + + +#if REPLACE_FCHDIR + /* Implementing fchdir and fdopendir requires the ability to open a + directory file descriptor. If open doesn't support that (as on + mingw), we use a dummy file that behaves the same as directories + on Linux (ie. always reports EOF on attempts to read()), and + override fstat() in fchdir.c to hide the fact that we have a + dummy. */ + if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES + && ((flags & O_ACCMODE) == O_RDONLY + || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH))) + { + struct stat statbuf; + if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) + { + /* Maximum recursion depth of 1. */ + fd = open ("/dev/null", flags, mode); + if (0 <= fd) + fd = _gl_register_fd (fd, filename); + } + else + errno = EACCES; + } +#endif + +#if OPEN_TRAILING_SLASH_BUG + /* If the filename ends in a slash and fd does not refer to a directory, + then fail. + Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> + says that + "A pathname that contains at least one non-slash character and that + ends with one or more trailing slashes shall be resolved as if a + single dot character ( '.' ) were appended to the pathname." + and + "The special filename dot shall refer to the directory specified by + its predecessor." + If the named file without the slash is not a directory, open() must fail + with ENOTDIR. */ + if (fd >= 0) + { + /* We know len is positive, since open did not fail with ENOENT. */ + size_t len = strlen (filename); + if (filename[len - 1] == '/') + { + struct stat statbuf; + + if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) + { + close (fd); + errno = ENOTDIR; + return -1; + } + } + } +#endif + +#if REPLACE_FCHDIR + if (!REPLACE_OPEN_DIRECTORY && 0 <= fd) + fd = _gl_register_fd (fd, filename); +#endif + + return fd; +} diff --git a/lib/openat-priv.h b/lib/openat-priv.h index 2598719eccf..b5a411b944b 100644 --- a/lib/openat-priv.h +++ b/lib/openat-priv.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/openat-proc.c b/lib/openat-proc.c index 101449bbb7f..6d2b598c8b2 100644 --- a/lib/openat-proc.c +++ b/lib/openat-proc.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/openat.h b/lib/openat.h index a036081e0af..1c4f64a32ed 100644 --- a/lib/openat.h +++ b/lib/openat.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Jim Meyering */ diff --git a/lib/pipe2.c b/lib/pipe2.c index 830f006bd36..741cee99ff6 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/pselect.c b/lib/pselect.c index 0c44ca9c0ff..2ea7c45307c 100644 --- a/lib/pselect.c +++ b/lib/pselect.c @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* written by Paul Eggert */ diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c index cb213303fbd..9ccf89b51fb 100644 --- a/lib/pthread_sigmask.c +++ b/lib/pthread_sigmask.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/putenv.c b/lib/putenv.c index b55e2620932..7831864478e 100644 --- a/lib/putenv.c +++ b/lib/putenv.c @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/qcopy-acl.c b/lib/qcopy-acl.c index fdf0a052b98..003cb42b7db 100644 --- a/lib/qcopy-acl.c +++ b/lib/qcopy-acl.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */ diff --git a/lib/readlink.c b/lib/readlink.c index bf0cedc5fa2..cd9604b224c 100644 --- a/lib/readlink.c +++ b/lib/readlink.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/readlinkat.c b/lib/readlinkat.c index 29a71ddfc27..c9880e1c704 100644 --- a/lib/readlinkat.c +++ b/lib/readlinkat.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* written by Eric Blake */ diff --git a/lib/root-uid.h b/lib/root-uid.h index 3a0037a4863..4aa9dfe24f0 100644 --- a/lib/root-uid.h +++ b/lib/root-uid.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert. */ diff --git a/lib/save-cwd.c b/lib/save-cwd.c index c1de48e87de..fbd944bb722 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Gnulib needs to save and restore the current working directory to fully emulate functions like fstatat. But Emacs doesn't care what diff --git a/lib/save-cwd.h b/lib/save-cwd.h index d066a0e5644..577bc35dc07 100644 --- a/lib/save-cwd.h +++ b/lib/save-cwd.h @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/lib/secure_getenv.c b/lib/secure_getenv.c deleted file mode 100644 index df53dea0b2f..00000000000 --- a/lib/secure_getenv.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Look up an environment variable, returning NULL in insecure situations. - - Copyright 2013-2017 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -#include <stdlib.h> - -#if !HAVE___SECURE_GETENV -# if HAVE_ISSETUGID || (HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID) -# include <unistd.h> -# endif -#endif - -char * -secure_getenv (char const *name) -{ -#if HAVE___SECURE_GETENV /* glibc */ - return __secure_getenv (name); -#elif HAVE_ISSETUGID /* OS X, FreeBSD, NetBSD, OpenBSD */ - if (issetugid ()) - return NULL; - return getenv (name); -#elif HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID /* other Unix */ - if (geteuid () != getuid () || getegid () != getgid ()) - return NULL; - return getenv (name); -#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* native Windows */ - /* On native Windows, there is no such concept as setuid or setgid binaries. - - Programs launched as system services have high privileges, but they don't - inherit environment variables from a user. - - Programs launched by a user with "Run as Administrator" have high - privileges and use the environment variables, but the user has been asked - whether he agrees. - - Programs launched by a user without "Run as Administrator" cannot gain - high privileges, therefore there is no risk. */ - return getenv (name); -#else - return NULL; -#endif -} diff --git a/lib/set-permissions.c b/lib/set-permissions.c index 75bb2dcce42..b30841fca40 100644 --- a/lib/set-permissions.c +++ b/lib/set-permissions.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */ diff --git a/lib/sha1.c b/lib/sha1.c index a57814131d6..ca3eabc45e7 100644 --- a/lib/sha1.c +++ b/lib/sha1.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Scott G. Miller Credits: diff --git a/lib/sha1.h b/lib/sha1.h index fcef9ce2c60..dd48889fa4c 100644 --- a/lib/sha1.h +++ b/lib/sha1.h @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef SHA1_H # define SHA1_H 1 diff --git a/lib/sha256.c b/lib/sha256.c index c0fb8beecfe..449a9b7b712 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by David Madore, considerably copypasting from Scott G. Miller's sha1.c diff --git a/lib/sha256.h b/lib/sha256.h index 348b76ef265..b998aa4b634 100644 --- a/lib/sha256.h +++ b/lib/sha256.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef SHA256_H # define SHA256_H 1 diff --git a/lib/sha512.c b/lib/sha512.c index dbde67183b7..e666231148e 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by David Madore, considerably copypasting from Scott G. Miller's sha1.c diff --git a/lib/sha512.h b/lib/sha512.h index 4460e6c9b76..70a3f9ad6cb 100644 --- a/lib/sha512.h +++ b/lib/sha512.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef SHA512_H # define SHA512_H 1 diff --git a/lib/sig2str.c b/lib/sig2str.c index c50c612b397..a3ed970063e 100644 --- a/lib/sig2str.c +++ b/lib/sig2str.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/sig2str.h b/lib/sig2str.h index 9bec78ed6af..4e43ea404c1 100644 --- a/lib/sig2str.h +++ b/lib/sig2str.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/signal.in.h b/lib/signal.in.h index 1ffba37e239..e8107c37bf5 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -200,7 +200,7 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1]; /* When also using extern inline, suppress the use of static inline in standard headers of problematic Apple configurations, as Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., - <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. Perhaps Apple will fix this some day. */ #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ && (defined __i386__ || defined __x86_64__)) diff --git a/lib/stat-time.h b/lib/stat-time.h index 9e45e855655..1cf821992ed 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -13,13 +13,17 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ #ifndef STAT_TIME_H #define STAT_TIME_H 1 +#include "intprops.h" + +#include <errno.h> +#include <stddef.h> #include <sys/stat.h> #include <time.h> @@ -202,6 +206,47 @@ get_stat_birthtime (struct stat const *st) return t; } +/* If a stat-like function returned RESULT, normalize the timestamps + in *ST, in case this platform suffers from the Solaris 11 bug where + tv_nsec might be negative. Return the adjusted RESULT, setting + errno to EOVERFLOW if normalization overflowed. This function + is intended to be private to this .h file. */ +_GL_STAT_TIME_INLINE int +stat_time_normalize (int result, struct stat *st) +{ +#if defined __sun && defined STAT_TIMESPEC + if (result == 0) + { + long int timespec_resolution = 1000000000; + short int const ts_off[] = { offsetof (struct stat, st_atim), + offsetof (struct stat, st_mtim), + offsetof (struct stat, st_ctim) }; + int i; + for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++) + { + struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]); + long int q = ts->tv_nsec / timespec_resolution; + long int r = ts->tv_nsec % timespec_resolution; + if (r < 0) + { + r += timespec_resolution; + q--; + } + ts->tv_nsec = r; + /* Overflow is possible, as Solaris 11 stat can yield + tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. + INT_ADD_WRAPV is OK, since time_t is signed on Solaris. */ + if (INT_ADD_WRAPV (q, ts->tv_sec, &ts->tv_sec)) + { + errno = EOVERFLOW; + return -1; + } + } + } +#endif + return result; +} + #ifdef __cplusplus } #endif diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index ea248231701..68e889e053c 100644 --- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert and Bruno Haible. */ @@ -53,7 +53,7 @@ #undef _Alignof /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 - <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ #if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9))) # ifdef __cplusplus diff --git a/lib/stddef.in.h b/lib/stddef.in.h index 5b496a68320..758ccf63386 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ @@ -85,24 +85,28 @@ a hack in case the configure-time test was done with g++ even though we are currently compiling with gcc. */ #if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) +# if !GNULIB_defined_max_align_t /* On the x86, the maximum storage alignment of double, long, etc. is 4, but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, and the C11 standard allows this. Work around this problem by using __alignof__ (which returns 8 for double) rather than _Alignof (which returns 4), and align each union member accordingly. */ -# ifdef __GNUC__ -# define _GL_STDDEF_ALIGNAS(type) \ - __attribute__ ((__aligned__ (__alignof__ (type)))) -# else -# define _GL_STDDEF_ALIGNAS(type) /* */ -# endif +# ifdef __GNUC__ +# define _GL_STDDEF_ALIGNAS(type) \ + __attribute__ ((__aligned__ (__alignof__ (type)))) +# else +# define _GL_STDDEF_ALIGNAS(type) /* */ +# endif typedef union { char *__p _GL_STDDEF_ALIGNAS (char *); double __d _GL_STDDEF_ALIGNAS (double); long double __ld _GL_STDDEF_ALIGNAS (long double); long int __i _GL_STDDEF_ALIGNAS (long int); -} max_align_t; +} rpl_max_align_t; +# define max_align_t rpl_max_align_t +# define GNULIB_defined_max_align_t 1 +# endif #endif # endif /* _@GUARD_PREFIX@_STDDEF_H */ diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 5fbec34310f..df8b37d3d49 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* * ISO C 99 <stdint.h> for platforms that lack it. diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index 75a945eb724..329801ad23b 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Many stdio implementations have the same logic and therefore can share the same implementation of stdio extension API, except that some fields @@ -32,7 +32,7 @@ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __DragonFly__ /* DragonFly */ - /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ + /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/lib/libc/stdio/priv_stdio.h>. */ # define fp_ ((struct { struct __FILE_public pub; \ struct { unsigned char *_base; int _size; } _bf; \ void *cookie; \ @@ -49,7 +49,7 @@ fpos_t _offset; \ /* More fields, not relevant here. */ \ } *) fp) - /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ + /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/include/stdio.h>. */ # define _p pub._p # define _flags pub._flags # define _r pub._r @@ -60,7 +60,7 @@ # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Minix 3, Android */ /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> - and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ + and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ struct __sfileext { struct __sbuf _ub; /* ungetc buffer */ @@ -81,7 +81,7 @@ #ifdef __TANDEM /* NonStop Kernel */ # ifndef _IOERR /* These values were determined by the program 'stdioext-flags' at - <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */ # define _IOERR 0x40 # define _IOREAD 0x80 # define _IOWRT 0x4 @@ -99,6 +99,8 @@ int _file; \ unsigned int _flag; \ } *) fp) +# elif defined __VMS /* OpenVMS */ +# define fp_ ((struct _iobuf *) fp) # else # define fp_ fp # endif @@ -130,7 +132,7 @@ struct _gl_real_FILE # define fp_ ((struct _gl_real_FILE *) fp) /* These values were determined by a program similar to the one at - <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */ + <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */ # define _IOREAD 0x1 # define _IOWRT 0x2 # define _IORW 0x4 diff --git a/lib/stdio.in.h b/lib/stdio.in.h index d706377f984..505f3f49f4e 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -111,9 +111,9 @@ #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) -/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */ +/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ /* But in any case avoid namespace pollution on glibc systems. */ -#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ && ! defined __GLIBC__ # include <unistd.h> #endif @@ -152,7 +152,7 @@ /* When also using extern inline, suppress the use of static inline in standard headers of problematic Apple configurations, as Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., - <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. Perhaps Apple will fix this some day. */ #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ && defined __GNUC__ && defined __STDC__) @@ -610,7 +610,7 @@ _GL_CXXALIAS_SYS (fwrite, size_t, (const void *ptr, size_t s, size_t n, FILE *stream)); /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 - <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>, + <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>, which sometimes causes an unwanted diagnostic for fwrite calls. This affects only function declaration attributes under certain versions of gcc and clang, and is not needed for C++. */ diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index b5cf9d36958..d5fa02b57ab 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -597,7 +597,7 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if !@HAVE_RANDOM@ || !@HAVE_DECL_INITSTATE@ _GL_FUNCDECL_SYS (initstate, char *, (unsigned int seed, char *buf, size_t buf_size) _GL_ARG_NONNULL ((2))); @@ -614,7 +614,7 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - " #endif #if @GNULIB_RANDOM@ -# if !@HAVE_RANDOM@ +# if !@HAVE_RANDOM@ || !@HAVE_DECL_SETSTATE@ _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); @@ -765,6 +765,23 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " "use gnulib module realloc-posix for portability"); #endif + +#if @GNULIB_REALLOCARRAY@ +# if ! @HAVE_REALLOCARRAY@ +_GL_FUNCDECL_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +# endif +_GL_CXXALIAS_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +_GL_CXXALIASWARN (reallocarray); +#elif defined GNULIB_POSIXCHECK +# undef reallocarray +# if HAVE_RAW_DECL_REALLOCARRAY +_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " + "use gnulib module reallocarray for portability"); +# endif +#endif + #if @GNULIB_REALPATH@ # if @REPLACE_REALPATH@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) diff --git a/lib/stpcpy.c b/lib/stpcpy.c index 154d95f89eb..079599db868 100644 --- a/lib/stpcpy.c +++ b/lib/stpcpy.c @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strftime.h b/lib/strftime.h index 27a8d624125..9d91e5139cd 100644 --- a/lib/strftime.h +++ b/lib/strftime.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <time.h> diff --git a/lib/string.in.h b/lib/string.in.h index 9a6b311d007..0e0e0c51f5e 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -74,6 +74,23 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ +/* Clear a block of memory. The compiler will not delete a call to + this function, even if the block is dead after the call. */ +#if @GNULIB_EXPLICIT_BZERO@ +# if ! @HAVE_EXPLICIT_BZERO@ +_GL_FUNCDECL_SYS (explicit_bzero, void, + (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); +_GL_CXXALIASWARN (explicit_bzero); +#elif defined GNULIB_POSIXCHECK +# undef explicit_bzero +# if HAVE_RAW_DECL_EXPLICIT_BZERO +_GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " + "use gnulib module explicit_bzero for portability"); +# endif +#endif + /* Find the index of the least-significant set bit. */ #if @GNULIB_FFSL@ # if !@HAVE_FFSL@ diff --git a/lib/strtoimax.c b/lib/strtoimax.c index 3f31fe913ad..f7d46f040d7 100644 --- a/lib/strtoimax.c +++ b/lib/strtoimax.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/strtol.c b/lib/strtol.c index 751d1e0f1e8..1ef88700fca 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -17,7 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifdef _LIBC # define USE_NUMBER_GROUPING diff --git a/lib/strtoll.c b/lib/strtoll.c index d770e81db39..f6952f3cd23 100644 --- a/lib/strtoll.c +++ b/lib/strtoll.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #define QUAD 1 diff --git a/lib/symlink.c b/lib/symlink.c index 60d4c14feab..427f1f5f00c 100644 --- a/lib/symlink.c +++ b/lib/symlink.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index 616e77dd4cf..3bda2122277 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ # if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 1831740900b..f0919e90d5c 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index 57739bc4c56..8a3c87d11d8 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h index 3cea44884e3..b0d6132a163 100644 --- a/lib/sys_types.in.h +++ b/lib/sys_types.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ diff --git a/lib/tempname.c b/lib/tempname.c index 2cd90328bda..2e3f95f3fb1 100644 --- a/lib/tempname.c +++ b/lib/tempname.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */ @@ -69,7 +69,6 @@ # define __mkdir mkdir # define __open open # define __lxstat64(version, file, buf) lstat (file, buf) -# define __secure_getenv secure_getenv #endif #ifdef _LIBC @@ -279,7 +278,7 @@ try_nocreate (char *tmpl, void *flags _GL_UNUSED) { struct_stat64 st; - if (__lxstat64 (_STAT_VER, tmpl, &st) == 0) + if (__lxstat64 (_STAT_VER, tmpl, &st) == 0 || errno == EOVERFLOW) __set_errno (EEXIST); return errno == ENOENT ? 0 : -1; } diff --git a/lib/tempname.h b/lib/tempname.h index 1ca97484fb4..245c8161abe 100644 --- a/lib/tempname.h +++ b/lib/tempname.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* header written by Eric Blake */ diff --git a/lib/time-internal.h b/lib/time-internal.h index bf22834b2e1..8caf11d8746 100644 --- a/lib/time-internal.h +++ b/lib/time-internal.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/time.in.h b/lib/time.in.h index f0c7ef86667..d210fbf80b1 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ diff --git a/lib/time_r.c b/lib/time_r.c index 708a98b3241..8cf8329fe5d 100644 --- a/lib/time_r.c +++ b/lib/time_r.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/time_rz.c b/lib/time_rz.c index 17bc11c20e9..ad02edb23cb 100644 --- a/lib/time_rz.c +++ b/lib/time_rz.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/timegm.c b/lib/timegm.c index 957a3b830c9..1cabf648264 100644 --- a/lib/timegm.c +++ b/lib/timegm.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LIBC # include <config.h> diff --git a/lib/timespec-add.c b/lib/timespec-add.c index e6c87c65683..faa45829445 100644 --- a/lib/timespec-add.c +++ b/lib/timespec-add.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c index 5d9276dd0f7..3872f1bc2db 100644 --- a/lib/timespec-sub.c +++ b/lib/timespec-sub.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/timespec.h b/lib/timespec.h index f5d823aefe9..84c8146a3ea 100644 --- a/lib/timespec.h +++ b/lib/timespec.h @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if ! defined TIMESPEC_H # define TIMESPEC_H @@ -33,6 +33,8 @@ _GL_INLINE_HEADER_BEGIN extern "C" { #endif +#include "verify.h" + /* Resolution of timespec timestamps (in units per second), and log base 10 of the resolution. */ @@ -67,23 +69,29 @@ make_timespec (time_t s, long int ns) any platform of interest to the GNU project, since all such platforms have 32-bit int or wider. - Replacing "(int) (a.tv_nsec - b.tv_nsec)" with something like + Replacing "a.tv_nsec - b.tv_nsec" with something like "a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause this function to work in some cases where the above assumption is violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2, b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the extra instructions. Using a subtraction has the advantage of detecting some invalid cases on platforms that detect integer - overflow. - - The (int) cast avoids a gcc -Wconversion warning. */ + overflow. */ _GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE timespec_cmp (struct timespec a, struct timespec b) { - return (a.tv_sec < b.tv_sec ? -1 - : a.tv_sec > b.tv_sec ? 1 - : (int) (a.tv_nsec - b.tv_nsec)); + if (a.tv_sec < b.tv_sec) + return -1; + if (a.tv_sec > b.tv_sec) + return 1; + + /* Pacify gcc -Wstrict-overflow (bleeding-edge circa 2017-10-02). See: + http://lists.gnu.org/r/bug-gnulib/2017-10/msg00006.html */ + assume (-1 <= a.tv_nsec && a.tv_nsec <= 2 * TIMESPEC_RESOLUTION); + assume (-1 <= b.tv_nsec && b.tv_nsec <= 2 * TIMESPEC_RESOLUTION); + + return a.tv_nsec - b.tv_nsec; } /* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be diff --git a/lib/u64.h b/lib/u64.h index a8601932a13..f56cc382339 100644 --- a/lib/u64.h +++ b/lib/u64.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index f366caffa55..91447835811 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _@GUARD_PREFIX@_UNISTD_H @@ -134,9 +134,8 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ -/* Get getopt(), optarg, optind, opterr, optopt. - But avoid namespace pollution on glibc systems. */ -#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT +/* Get getopt(), optarg, optind, opterr, optopt. */ +#if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT # include <getopt-cdefs.h> # include <getopt-pfx-core.h> #endif @@ -379,7 +378,7 @@ _GL_WARN_ON_USE (dup2, "dup2 is unportable - " Close NEWFD first if it is open. Return newfd if successful, otherwise -1 and errno set. See the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ + <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ # if @HAVE_DUP3@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup3 rpl_dup3 @@ -462,13 +461,25 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " #if @GNULIB_FACCESSAT@ -# if !@HAVE_FACCESSAT@ +# if @REPLACE_FACCESSAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef faccessat +# define faccessat rpl_faccessat +# endif +_GL_FUNCDECL_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag)); +# else +# if !@HAVE_FACCESSAT@ _GL_FUNCDECL_SYS (faccessat, int, (int fd, char const *file, int mode, int flag) _GL_ARG_NONNULL ((2))); -# endif +# endif _GL_CXXALIAS_SYS (faccessat, int, (int fd, char const *file, int mode, int flag)); +# endif _GL_CXXALIASWARN (faccessat); #elif defined GNULIB_POSIXCHECK # undef faccessat @@ -1149,7 +1160,7 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - " Store the read-end as fd[0] and the write-end as fd[1]. Return 0 upon success, or -1 with errno set upon failure. See also the Linux man page at - <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ + <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ # if @HAVE_PIPE2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define pipe2 rpl_pipe2 diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h new file mode 100644 index 00000000000..be5d2b5d847 --- /dev/null +++ b/lib/unlocked-io.h @@ -0,0 +1,136 @@ +/* Prefer faster, non-thread-safe stdio functions if available. + + Copyright (C) 2001-2004, 2009-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Jim Meyering. */ + +#ifndef UNLOCKED_IO_H +# define UNLOCKED_IO_H 1 + +/* These are wrappers for functions/macros from the GNU C library, and + from other C libraries supporting POSIX's optional thread-safe functions. + + The standard I/O functions are thread-safe. These *_unlocked ones are + more efficient but not thread-safe. That they're not thread-safe is + fine since all of the applications in this package are single threaded. + + Also, some code that is shared with the GNU C library may invoke + the *_unlocked functions directly. On hosts that lack those + functions, invoke the non-thread-safe versions instead. */ + +# include <stdio.h> + +# if HAVE_DECL_CLEARERR_UNLOCKED +# undef clearerr +# define clearerr(x) clearerr_unlocked (x) +# else +# define clearerr_unlocked(x) clearerr (x) +# endif + +# if HAVE_DECL_FEOF_UNLOCKED +# undef feof +# define feof(x) feof_unlocked (x) +# else +# define feof_unlocked(x) feof (x) +# endif + +# if HAVE_DECL_FERROR_UNLOCKED +# undef ferror +# define ferror(x) ferror_unlocked (x) +# else +# define ferror_unlocked(x) ferror (x) +# endif + +# if HAVE_DECL_FFLUSH_UNLOCKED +# undef fflush +# define fflush(x) fflush_unlocked (x) +# else +# define fflush_unlocked(x) fflush (x) +# endif + +# if HAVE_DECL_FGETS_UNLOCKED +# undef fgets +# define fgets(x,y,z) fgets_unlocked (x,y,z) +# else +# define fgets_unlocked(x,y,z) fgets (x,y,z) +# endif + +# if HAVE_DECL_FPUTC_UNLOCKED +# undef fputc +# define fputc(x,y) fputc_unlocked (x,y) +# else +# define fputc_unlocked(x,y) fputc (x,y) +# endif + +# if HAVE_DECL_FPUTS_UNLOCKED +# undef fputs +# define fputs(x,y) fputs_unlocked (x,y) +# else +# define fputs_unlocked(x,y) fputs (x,y) +# endif + +# if HAVE_DECL_FREAD_UNLOCKED +# undef fread +# define fread(w,x,y,z) fread_unlocked (w,x,y,z) +# else +# define fread_unlocked(w,x,y,z) fread (w,x,y,z) +# endif + +# if HAVE_DECL_FWRITE_UNLOCKED +# undef fwrite +# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) +# else +# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) +# endif + +# if HAVE_DECL_GETC_UNLOCKED +# undef getc +# define getc(x) getc_unlocked (x) +# else +# define getc_unlocked(x) getc (x) +# endif + +# if HAVE_DECL_GETCHAR_UNLOCKED +# undef getchar +# define getchar() getchar_unlocked () +# else +# define getchar_unlocked() getchar () +# endif + +# if HAVE_DECL_PUTC_UNLOCKED +# undef putc +# define putc(x,y) putc_unlocked (x,y) +# else +# define putc_unlocked(x,y) putc (x,y) +# endif + +# if HAVE_DECL_PUTCHAR_UNLOCKED +# undef putchar +# define putchar(x) putchar_unlocked (x) +# else +# define putchar_unlocked(x) putchar (x) +# endif + +# undef flockfile +# define flockfile(x) ((void) 0) + +# undef ftrylockfile +# define ftrylockfile(x) 0 + +# undef funlockfile +# define funlockfile(x) ((void) 0) + +#endif /* UNLOCKED_IO_H */ diff --git a/lib/utimens.c b/lib/utimens.c index ff4eab073c1..55545e8ce9b 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -196,7 +196,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) /* Some Linux-based NFS clients are buggy, and mishandle timestamps of files in NFS file systems in some cases. We have no configure-time test for this, but please see - <http://bugs.gentoo.org/show_bug.cgi?id=132673> for references to + <https://bugs.gentoo.org/show_bug.cgi?id=132673> for references to some of the problems with Linux 2.6.16. If this affects you, compile with -DHAVE_BUGGY_NFS_TIME_STAMPS; this is reported to help in some cases, albeit at a cost in performance. But you @@ -250,8 +250,8 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) result = utimensat (AT_FDCWD, file, ts, 0); # ifdef __linux__ /* Work around a kernel bug: - http://bugzilla.redhat.com/442352 - http://bugzilla.redhat.com/449910 + https://bugzilla.redhat.com/show_bug.cgi?id=442352 + https://bugzilla.redhat.com/show_bug.cgi?id=449910 It appears that utimensat can mistakenly return 280 rather than -1 upon ENOSYS failure. FIXME: remove in 2010 or whenever the offending kernels @@ -566,8 +566,8 @@ lutimens (char const *file, struct timespec const timespec[2]) result = utimensat (AT_FDCWD, file, ts, AT_SYMLINK_NOFOLLOW); # ifdef __linux__ /* Work around a kernel bug: - http://bugzilla.redhat.com/442352 - http://bugzilla.redhat.com/449910 + https://bugzilla.redhat.com/show_bug.cgi?id=442352 + https://bugzilla.redhat.com/show_bug.cgi?id=449910 It appears that utimensat can mistakenly return 280 rather than -1 upon ENOSYS failure. FIXME: remove in 2010 or whenever the offending kernels diff --git a/lib/utimens.h b/lib/utimens.h index 4d9c18edad1..f1dd9884dc1 100644 --- a/lib/utimens.h +++ b/lib/utimens.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ diff --git a/lib/verify.h b/lib/verify.h index dcba9c8cb0a..e0b48613374 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ diff --git a/lib/vla.h b/lib/vla.h index 5bbf56bb398..59de9a6bcd6 100644 --- a/lib/vla.h +++ b/lib/vla.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + along with this program. If not, see <https://www.gnu.org/licenses/>. Written by Paul Eggert. */ diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h index 3c0eb579fa2..cae8c3eec5c 100644 --- a/lib/warn-on-use.h +++ b/lib/warn-on-use.h @@ -12,7 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* _GL_WARN_ON_USE (function, "literal string") issues a declaration for FUNCTION which will then trigger a compiler warning containing diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h index ff0efc6ba40..ae4fbc77f98 100644 --- a/lib/xalloc-oversized.h +++ b/lib/xalloc-oversized.h @@ -13,7 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ #ifndef XALLOC_OVERSIZED_H_ #define XALLOC_OVERSIZED_H_ @@ -44,7 +44,7 @@ typedef size_t __xalloc_count_type; #if 7 <= __GNUC__ # define xalloc_oversized(n, s) \ __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) -#elif 5 <= __GNUC__ && !__STRICT_ANSI__ +#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ # define xalloc_oversized(n, s) \ (__builtin_constant_p (n) && __builtin_constant_p (s) \ ? __xalloc_oversized (n, s) \ |