aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2018-06-29 17:31:04 -0700
committerPaul Eggert2018-06-29 17:32:35 -0700
commit35e9dcab5141bf9cae67abe740933fe627ecc371 (patch)
tree2813d1f6340df34a97695874e5546e4b2454d555
parent2e2811865f0adb6658a87d3581a2dc3a9022f451 (diff)
downloademacs-35e9dcab5141bf9cae67abe740933fe627ecc371.tar.gz
emacs-35e9dcab5141bf9cae67abe740933fe627ecc371.zip
Update from Gnulib
This incorporates: 2018-06-29 regex: glibc does not use intprops.h 2018-06-28 regex: port to recently proposed glibc regex merge 2018-06-25 Continue to use spaces for indentation, not tabs 2018-06-25 manywarnings: Don't enable -Wjump-misses-init by default 2018-06-25 acl-internal.h: remove _GL_ATTRIBUTE_CONST on void function 2018-06-24 manywarnings: accommodate GCC 9: remove -Wchkp and -Wabi 2018-06-24 maint: clarify comments about sticky EOF 2018-06-24 af_alg: avoid hangs when reading from streams 2018-06-17 crypto: use byteswap 2018-06-17 getloadavg: Return 0 on MS-Windows without Cygwi 2018-06-17 getloadavg: Allow building on MS-Windows without Cygwin * build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex: * lib/acl-internal.c, lib/acl-internal.h, lib/get-permissions.c: * lib/getloadavg.c, lib/gettimeofday.c, lib/md5.c, lib/pselect.c: * lib/set-permissions.c, lib/sha1.c, lib/sha256.c, lib/sha512.c: * lib/time.in.h, m4/getloadavg.m4, m4/gnulib-common.m4: * m4/manywarnings.m4, m4/pthread_sigmask.m4, m4/vararrays.m4: Copy from Gnulib.
-rwxr-xr-xbuild-aux/config.guess6
-rwxr-xr-xbuild-aux/config.sub209
-rw-r--r--doc/misc/texinfo.tex5
-rw-r--r--lib/acl-internal.c2
-rw-r--r--lib/acl-internal.h6
-rw-r--r--lib/get-permissions.c88
-rw-r--r--lib/getloadavg.c10
-rw-r--r--lib/gettimeofday.c2
-rw-r--r--lib/md5.c18
-rw-r--r--lib/pselect.c4
-rw-r--r--lib/set-permissions.c254
-rw-r--r--lib/sha1.c18
-rw-r--r--lib/sha256.c18
-rw-r--r--lib/sha512.c25
-rw-r--r--lib/time.in.h2
-rw-r--r--m4/getloadavg.m42
-rw-r--r--m4/gnulib-common.m420
-rw-r--r--m4/manywarnings.m47
-rw-r--r--m4/pthread_sigmask.m470
-rw-r--r--m4/vararrays.m466
20 files changed, 404 insertions, 428 deletions
diff --git a/build-aux/config.guess b/build-aux/config.guess
index 883a6713bf0..445c406836e 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -2,7 +2,7 @@
2# Attempt to guess a canonical system name. 2# Attempt to guess a canonical system name.
3# Copyright 1992-2018 Free Software Foundation, Inc. 3# Copyright 1992-2018 Free Software Foundation, Inc.
4 4
5timestamp='2018-05-19' 5timestamp='2018-06-26'
6 6
7# This file is free software; you can redistribute it and/or modify it 7# This file is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by 8# under the terms of the GNU General Public License as published by
@@ -894,8 +894,8 @@ EOF
894 # other systems with GNU libc and userland 894 # other systems with GNU libc and userland
895 echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" 895 echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
896 exit ;; 896 exit ;;
897 i*86:Minix:*:*) 897 *:Minix:*:*)
898 echo "$UNAME_MACHINE"-pc-minix 898 echo "$UNAME_MACHINE"-unknown-minix
899 exit ;; 899 exit ;;
900 aarch64:Linux:*:*) 900 aarch64:Linux:*:*)
901 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 901 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
diff --git a/build-aux/config.sub b/build-aux/config.sub
index f38250f1daa..d1f5b549034 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -2,7 +2,7 @@
2# Configuration validation subroutine script. 2# Configuration validation subroutine script.
3# Copyright 1992-2018 Free Software Foundation, Inc. 3# Copyright 1992-2018 Free Software Foundation, Inc.
4 4
5timestamp='2018-05-19' 5timestamp='2018-05-24'
6 6
7# This file is free software; you can redistribute it and/or modify it 7# This file is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by 8# under the terms of the GNU General Public License as published by
@@ -149,8 +149,30 @@ case $1 in
149 esac 149 esac
150 ;; 150 ;;
151 *-*) 151 *-*)
152 basic_machine=$field1 152 # Second component is usually, but not always the OS
153 os=$field2 153 case $field2 in
154 # Prevent following clause from handling this valid os
155 sun*os*)
156 basic_machine=$field1
157 os=$field2
158 ;;
159 # Manufacturers
160 dec* | mips* | sequent* | encore* | pc532* | sgi* | sony* \
161 | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
162 | unicom* | ibm* | next | hp | isi* | apollo | altos* \
163 | convergent* | ncr* | news | 32* | 3600* | 3100* | hitachi* \
164 | c[123]* | convex* | sun | crds | omron* | dg | ultra | tti* \
165 | harris | dolphin | highlevel | gould | cbm | ns | masscomp \
166 | apple | axis | knuth | cray | microblaze* \
167 | sim | cisco | oki | wec | wrs | winbond)
168 basic_machine=$field1-$field2
169 os=
170 ;;
171 *)
172 basic_machine=$field1
173 os=$field2
174 ;;
175 esac
154 ;; 176 ;;
155 *) 177 *)
156 # Convert single-component short-hands not valid as part of 178 # Convert single-component short-hands not valid as part of
@@ -540,110 +562,6 @@ case $1 in
540 ;; 562 ;;
541esac 563esac
542 564
543### Let's recognize common machines as not being operating systems so
544### that things like config.sub decstation-3100 work. We also
545### recognize some manufacturers as not being operating systems, so we
546### can provide default operating systems below.
547case $os in
548 sun*os*)
549 # Prevent following clause from handling this invalid input.
550 ;;
551 dec* | mips* | sequent* | encore* | pc532* | sgi* | sony* | \
552 att* | 7300* | 3300* | delta* | motorola* | sun[234]* | \
553 unicom* | ibm* | next | hp | isi* | apollo | altos* | \
554 convergent* | ncr* | news | 32* | 3600* | 3100* | hitachi* |\
555 c[123]* | convex* | sun | crds | omron* | dg | ultra | tti* | \
556 harris | dolphin | highlevel | gould | cbm | ns | masscomp | \
557 apple | axis | knuth | cray | microblaze*)
558 os=
559 basic_machine=$1
560 ;;
561 bluegene*)
562 os=cnk
563 ;;
564 sim | cisco | oki | wec | winbond)
565 os=
566 basic_machine=$1
567 ;;
568 scout)
569 ;;
570 wrs)
571 os=vxworks
572 basic_machine=$1
573 ;;
574 chorusos*)
575 os=chorusos
576 basic_machine=$1
577 ;;
578 chorusrdb)
579 os=chorusrdb
580 basic_machine=$1
581 ;;
582 hiux*)
583 os=hiuxwe2
584 ;;
585 sco6)
586 os=sco5v6
587 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
588 ;;
589 sco5)
590 os=sco3.2v5
591 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
592 ;;
593 sco4)
594 os=sco3.2v4
595 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
596 ;;
597 sco3.2.[4-9]*)
598 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
599 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
600 ;;
601 sco3.2v[4-9]*)
602 # Don't forget version if it is 3.2v4 or newer.
603 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
604 ;;
605 sco5v6*)
606 # Don't forget version if it is 3.2v4 or newer.
607 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
608 ;;
609 sco*)
610 os=sco3.2v2
611 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
612 ;;
613 udk*)
614 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
615 ;;
616 isc)
617 os=isc2.2
618 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
619 ;;
620 clix*)
621 basic_machine=clipper-intergraph
622 ;;
623 isc*)
624 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
625 ;;
626 lynx*178)
627 os=lynxos178
628 ;;
629 lynx*5)
630 os=lynxos5
631 ;;
632 lynx*)
633 os=lynxos
634 ;;
635 ptx*)
636 basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
637 ;;
638 psos*)
639 os=psos
640 ;;
641 mint | mint[0-9]*)
642 basic_machine=m68k-atari
643 os=mint
644 ;;
645esac
646
647# Decode aliases for certain CPU-COMPANY combinations. 565# Decode aliases for certain CPU-COMPANY combinations.
648case $basic_machine in 566case $basic_machine in
649 # Recognize the basic CPU types without company name. 567 # Recognize the basic CPU types without company name.
@@ -1377,6 +1295,9 @@ case $os in
1377 auroraux) 1295 auroraux)
1378 os=auroraux 1296 os=auroraux
1379 ;; 1297 ;;
1298 bluegene*)
1299 os=cnk
1300 ;;
1380 solaris1 | solaris1.*) 1301 solaris1 | solaris1.*)
1381 os=`echo $os | sed -e 's|solaris1|sunos4|'` 1302 os=`echo $os | sed -e 's|solaris1|sunos4|'`
1382 ;; 1303 ;;
@@ -1393,26 +1314,57 @@ case $os in
1393 es1800*) 1314 es1800*)
1394 os=ose 1315 os=ose
1395 ;; 1316 ;;
1317 # Some version numbers need modification
1318 chorusos*)
1319 os=chorusos
1320 ;;
1321 isc)
1322 os=isc2.2
1323 ;;
1324 sco6)
1325 os=sco5v6
1326 ;;
1327 sco5)
1328 os=sco3.2v5
1329 ;;
1330 sco4)
1331 os=sco3.2v4
1332 ;;
1333 sco3.2.[4-9]*)
1334 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
1335 ;;
1336 sco3.2v[4-9]* | sco5v6*)
1337 # Don't forget version if it is 3.2v4 or newer.
1338 ;;
1339 scout)
1340 # Don't match below
1341 ;;
1342 sco*)
1343 os=sco3.2v2
1344 ;;
1345 psos*)
1346 os=psos
1347 ;;
1396 # Now accept the basic system types. 1348 # Now accept the basic system types.
1397 # The portable systems comes first. 1349 # The portable systems comes first.
1398 # Each alternative MUST end in a * to match a version number. 1350 # Each alternative MUST end in a * to match a version number.
1399 # sysv* is not here because it comes later, after sysvr4. 1351 # sysv* is not here because it comes later, after sysvr4.
1400 gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 1352 gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
1401 | *vms* | sco* | esix* | isc* | aix* | cnk* | sunos | sunos[34]*\ 1353 | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
1402 | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 1354 | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1403 | sym* | kopensolaris* | plan9* \ 1355 | sym* | kopensolaris* | plan9* \
1404 | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 1356 | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1405 | aos* | aros* | cloudabi* | sortix* \ 1357 | aos* | aros* | cloudabi* | sortix* \
1406 | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 1358 | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1407 | clix* | riscos* | uniplus* | iris* | rtu* | xenix* \ 1359 | clix* | riscos* | uniplus* | iris* | rtu* | xenix* \
1408 | hiux* | knetbsd* | mirbsd* | netbsd* \ 1360 | knetbsd* | mirbsd* | netbsd* \
1409 | bitrig* | openbsd* | solidbsd* | libertybsd* \ 1361 | bitrig* | openbsd* | solidbsd* | libertybsd* \
1410 | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ 1362 | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
1411 | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ 1363 | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1412 | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ 1364 | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1413 | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ 1365 | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \
1414 | chorusos* | chorusrdb* | cegcc* | glidix* \ 1366 | chorusrdb* | cegcc* | glidix* \
1415 | cygwin* | msys* | pe* | psos* | moss* | proelf* | rtems* \ 1367 | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1416 | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ 1368 | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \
1417 | linux-newlib* | linux-musl* | linux-uclibc* \ 1369 | linux-newlib* | linux-musl* | linux-uclibc* \
1418 | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 1370 | uxpv* | beos* | mpeix* | udk* | moxiebox* \
@@ -1436,6 +1388,9 @@ case $os in
1436 ;; 1388 ;;
1437 esac 1389 esac
1438 ;; 1390 ;;
1391 hiux*)
1392 os=hiuxwe2
1393 ;;
1439 nto-qnx*) 1394 nto-qnx*)
1440 ;; 1395 ;;
1441 nto*) 1396 nto*)
@@ -1445,20 +1400,23 @@ case $os in
1445 | windows* | osx | abug | netware* | os9* \ 1400 | windows* | osx | abug | netware* | os9* \
1446 | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) 1401 | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)
1447 ;; 1402 ;;
1448 mac*)
1449 os=`echo "$os" | sed -e 's|mac|macos|'`
1450 ;;
1451 linux-dietlibc) 1403 linux-dietlibc)
1452 os=linux-dietlibc 1404 os=linux-dietlibc
1453 ;; 1405 ;;
1454 linux*) 1406 linux*)
1455 os=`echo $os | sed -e 's|linux|linux-gnu|'` 1407 os=`echo $os | sed -e 's|linux|linux-gnu|'`
1456 ;; 1408 ;;
1457 sunos5*) 1409 lynx*178)
1458 os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 1410 os=lynxos178
1459 ;; 1411 ;;
1460 sunos6*) 1412 lynx*5)
1461 os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 1413 os=lynxos5
1414 ;;
1415 lynx*)
1416 os=lynxos
1417 ;;
1418 mac*)
1419 os=`echo "$os" | sed -e 's|mac|macos|'`
1462 ;; 1420 ;;
1463 opened*) 1421 opened*)
1464 os=openedition 1422 os=openedition
@@ -1466,6 +1424,12 @@ case $os in
1466 os400*) 1424 os400*)
1467 os=os400 1425 os=os400
1468 ;; 1426 ;;
1427 sunos5*)
1428 os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1429 ;;
1430 sunos6*)
1431 os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1432 ;;
1469 wince*) 1433 wince*)
1470 os=wince 1434 os=wince
1471 ;; 1435 ;;
@@ -1599,6 +1563,9 @@ case $basic_machine in
1599 c8051-*) 1563 c8051-*)
1600 os=elf 1564 os=elf
1601 ;; 1565 ;;
1566 clipper-intergraph)
1567 os=clix
1568 ;;
1602 hexagon-*) 1569 hexagon-*)
1603 os=elf 1570 os=elf
1604 ;; 1571 ;;
@@ -1744,6 +1711,9 @@ case $basic_machine in
1744 *-atari*) 1711 *-atari*)
1745 os=mint 1712 os=mint
1746 ;; 1713 ;;
1714 *-wrs)
1715 os=vxworks
1716 ;;
1747 *) 1717 *)
1748 os=none 1718 os=none
1749 ;; 1719 ;;
@@ -1789,6 +1759,9 @@ case $basic_machine in
1789 genix*) 1759 genix*)
1790 vendor=ns 1760 vendor=ns
1791 ;; 1761 ;;
1762 clix*)
1763 vendor=intergraph
1764 ;;
1792 mvs* | opened*) 1765 mvs* | opened*)
1793 vendor=ibm 1766 vendor=ibm
1794 ;; 1767 ;;
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index aa4f256437e..d7f7f53a348 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
3% Load plain if necessary, i.e., if running under initex. 3% Load plain if necessary, i.e., if running under initex.
4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5% 5%
6\def\texinfoversion{2018-03-10.14} 6\def\texinfoversion{2018-06-02.09}
7% 7%
8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -1528,6 +1528,9 @@ output) for that.)}
1528 \startlink attr{/Border [0 0 0]}% 1528 \startlink attr{/Border [0 0 0]}%
1529 user{/Subtype /Link /A << /S /URI /URI (#1) >>}% 1529 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1530 \endgroup} 1530 \endgroup}
1531 % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
1532 % be a simple number, or a list of numbers in the case of an index
1533 % entry.
1531 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} 1534 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1532 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} 1535 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1533 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} 1536 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
diff --git a/lib/acl-internal.c b/lib/acl-internal.c
index 383c5ddb6f6..c62adb0d9d5 100644
--- a/lib/acl-internal.c
+++ b/lib/acl-internal.c
@@ -355,7 +355,7 @@ acl_nontrivial (int count, struct acl_entry *entries)
355 struct acl_entry *ace = &entries[i]; 355 struct acl_entry *ace = &entries[i];
356 356
357 if (ace->uid != ACL_NSUSER && ace->gid != ACL_NSGROUP) 357 if (ace->uid != ACL_NSUSER && ace->gid != ACL_NSGROUP)
358 return 1; 358 return 1;
359 } 359 }
360 return 0; 360 return 0;
361} 361}
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index 6c65e65e5e7..0669d83c469 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -293,10 +293,6 @@ struct permission_context {
293 293
294int get_permissions (const char *, int, mode_t, struct permission_context *); 294int get_permissions (const char *, int, mode_t, struct permission_context *);
295int set_permissions (struct permission_context *, const char *, int); 295int set_permissions (struct permission_context *, const char *, int);
296void free_permission_context (struct permission_context *) 296void free_permission_context (struct permission_context *);
297#if ! (defined USE_ACL && (HAVE_ACL_GET_FILE || defined GETACL))
298 _GL_ATTRIBUTE_CONST
299#endif
300 ;
301 297
302_GL_INLINE_HEADER_END 298_GL_INLINE_HEADER_END
diff --git a/lib/get-permissions.c b/lib/get-permissions.c
index bb1af5dbdfc..83ba2639a17 100644
--- a/lib/get-permissions.c
+++ b/lib/get-permissions.c
@@ -31,7 +31,7 @@
31 31
32int 32int
33get_permissions (const char *name, int desc, mode_t mode, 33get_permissions (const char *name, int desc, mode_t mode,
34 struct permission_context *ctx) 34 struct permission_context *ctx)
35{ 35{
36 memset (ctx, 0, sizeof *ctx); 36 memset (ctx, 0, sizeof *ctx);
37 ctx->mode = mode; 37 ctx->mode = mode;
@@ -57,7 +57,7 @@ get_permissions (const char *name, int desc, mode_t mode,
57 { 57 {
58 ctx->default_acl = acl_get_file (name, ACL_TYPE_DEFAULT); 58 ctx->default_acl = acl_get_file (name, ACL_TYPE_DEFAULT);
59 if (ctx->default_acl == NULL) 59 if (ctx->default_acl == NULL)
60 return -1; 60 return -1;
61 } 61 }
62 62
63# if HAVE_ACL_TYPE_NFS4 /* FreeBSD */ 63# if HAVE_ACL_TYPE_NFS4 /* FreeBSD */
@@ -115,16 +115,16 @@ get_permissions (const char *name, int desc, mode_t mode,
115 int ret; 115 int ret;
116 116
117 if (desc != -1) 117 if (desc != -1)
118 ret = facl (desc, ACE_GETACLCNT, 0, NULL); 118 ret = facl (desc, ACE_GETACLCNT, 0, NULL);
119 else 119 else
120 ret = acl (name, ACE_GETACLCNT, 0, NULL); 120 ret = acl (name, ACE_GETACLCNT, 0, NULL);
121 if (ret < 0) 121 if (ret < 0)
122 { 122 {
123 if (errno == ENOSYS || errno == EINVAL) 123 if (errno == ENOSYS || errno == EINVAL)
124 ret = 0; 124 ret = 0;
125 else 125 else
126 return -1; 126 return -1;
127 } 127 }
128 ctx->ace_count = ret; 128 ctx->ace_count = ret;
129 129
130 if (ctx->ace_count == 0) 130 if (ctx->ace_count == 0)
@@ -138,15 +138,15 @@ get_permissions (const char *name, int desc, mode_t mode,
138 } 138 }
139 139
140 if (desc != -1) 140 if (desc != -1)
141 ret = facl (desc, ACE_GETACL, ctx->ace_count, ctx->ace_entries); 141 ret = facl (desc, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
142 else 142 else
143 ret = acl (name, ACE_GETACL, ctx->ace_count, ctx->ace_entries); 143 ret = acl (name, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
144 if (ret < 0) 144 if (ret < 0)
145 { 145 {
146 if (errno == ENOSYS || errno == EINVAL) 146 if (errno == ENOSYS || errno == EINVAL)
147 { 147 {
148 free (ctx->ace_entries); 148 free (ctx->ace_entries);
149 ctx->ace_entries = NULL; 149 ctx->ace_entries = NULL;
150 ctx->ace_count = 0; 150 ctx->ace_count = 0;
151 break; 151 break;
152 } 152 }
@@ -154,10 +154,10 @@ get_permissions (const char *name, int desc, mode_t mode,
154 return -1; 154 return -1;
155 } 155 }
156 if (ret <= ctx->ace_count) 156 if (ret <= ctx->ace_count)
157 { 157 {
158 ctx->ace_count = ret; 158 ctx->ace_count = ret;
159 break; 159 break;
160 } 160 }
161 /* Huh? The number of ACL entries has increased since the last call. 161 /* Huh? The number of ACL entries has increased since the last call.
162 Repeat. */ 162 Repeat. */
163 free (ctx->ace_entries); 163 free (ctx->ace_entries);
@@ -170,20 +170,20 @@ get_permissions (const char *name, int desc, mode_t mode,
170 int ret; 170 int ret;
171 171
172 if (desc != -1) 172 if (desc != -1)
173 ret = facl (desc, GETACLCNT, 0, NULL); 173 ret = facl (desc, GETACLCNT, 0, NULL);
174 else 174 else
175 ret = acl (name, GETACLCNT, 0, NULL); 175 ret = acl (name, GETACLCNT, 0, NULL);
176 if (ret < 0) 176 if (ret < 0)
177 { 177 {
178 if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP) 178 if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
179 ret = 0; 179 ret = 0;
180 else 180 else
181 return -1; 181 return -1;
182 } 182 }
183 ctx->count = ret; 183 ctx->count = ret;
184 184
185 if (ctx->count == 0) 185 if (ctx->count == 0)
186 break; 186 break;
187 187
188 ctx->entries = (aclent_t *) malloc (ctx->count * sizeof (aclent_t)); 188 ctx->entries = (aclent_t *) malloc (ctx->count * sizeof (aclent_t));
189 if (ctx->entries == NULL) 189 if (ctx->entries == NULL)
@@ -193,26 +193,26 @@ get_permissions (const char *name, int desc, mode_t mode,
193 } 193 }
194 194
195 if (desc != -1) 195 if (desc != -1)
196 ret = facl (desc, GETACL, ctx->count, ctx->entries); 196 ret = facl (desc, GETACL, ctx->count, ctx->entries);
197 else 197 else
198 ret = acl (name, GETACL, ctx->count, ctx->entries); 198 ret = acl (name, GETACL, ctx->count, ctx->entries);
199 if (ret < 0) 199 if (ret < 0)
200 { 200 {
201 if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP) 201 if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
202 { 202 {
203 free (ctx->entries); 203 free (ctx->entries);
204 ctx->entries = NULL; 204 ctx->entries = NULL;
205 ctx->count = 0; 205 ctx->count = 0;
206 break; 206 break;
207 } 207 }
208 else 208 else
209 return -1; 209 return -1;
210 } 210 }
211 if (ret <= ctx->count) 211 if (ret <= ctx->count)
212 { 212 {
213 ctx->count = ret; 213 ctx->count = ret;
214 break; 214 break;
215 } 215 }
216 /* Huh? The number of ACL entries has increased since the last call. 216 /* Huh? The number of ACL entries has increased since the last call.
217 Repeat. */ 217 Repeat. */
218 free (ctx->entries); 218 free (ctx->entries);
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 702338fb9e9..435d10a6b10 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -68,7 +68,7 @@
68 UMAX 68 UMAX
69 UMAX4_3 69 UMAX4_3
70 VMS 70 VMS
71 WINDOWS32 No-op for Windows95/NT. 71 _WIN32 Native Windows (possibly also defined on Cygwin)
72 __linux__ Linux: assumes /proc file system mounted. 72 __linux__ Linux: assumes /proc file system mounted.
73 Support from Michael K. Johnson. 73 Support from Michael K. Johnson.
74 __CYGWIN__ Cygwin emulates linux /proc/loadavg. 74 __CYGWIN__ Cygwin emulates linux /proc/loadavg.
@@ -97,6 +97,10 @@
97 97
98# include "intprops.h" 98# include "intprops.h"
99 99
100# if defined _WIN32 && ! defined __CYGWIN__
101# define WINDOWS32
102# endif
103
100# if !defined (BSD) && defined (ultrix) 104# if !defined (BSD) && defined (ultrix)
101/* Ultrix behaves like BSD on Vaxen. */ 105/* Ultrix behaves like BSD on Vaxen. */
102# define BSD 106# define BSD
@@ -324,7 +328,9 @@
324# define LDAV_SYMBOL "avenrun" 328# define LDAV_SYMBOL "avenrun"
325# endif 329# endif
326 330
327# include <unistd.h> 331# ifdef HAVE_UNISTD_H
332# include <unistd.h>
333# endif
328 334
329/* LOAD_AVE_TYPE should only get defined if we're going to use the 335/* LOAD_AVE_TYPE should only get defined if we're going to use the
330 nlist method. */ 336 nlist method. */
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index d598b2f7f56..fd44f45ca3c 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -45,7 +45,7 @@ initialize (void)
45 if (kernel32 != NULL) 45 if (kernel32 != NULL)
46 { 46 {
47 GetSystemTimePreciseAsFileTimeFunc = 47 GetSystemTimePreciseAsFileTimeFunc =
48 (GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime"); 48 (GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime");
49 } 49 }
50 initialized = TRUE; 50 initialized = TRUE;
51} 51}
diff --git a/lib/md5.c b/lib/md5.c
index 577aab46d7a..554d421c7bf 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -52,9 +52,9 @@
52# define md5_buffer __md5_buffer 52# define md5_buffer __md5_buffer
53#endif 53#endif
54 54
55#include <byteswap.h>
55#ifdef WORDS_BIGENDIAN 56#ifdef WORDS_BIGENDIAN
56# define SWAP(n) \ 57# define SWAP(n) bswap_32 (n)
57 (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
58#else 58#else
59# define SWAP(n) (n) 59# define SWAP(n) (n)
60#endif 60#endif
@@ -170,6 +170,14 @@ md5_stream (FILE *stream, void *resblock)
170 /* Read block. Take care for partial reads. */ 170 /* Read block. Take care for partial reads. */
171 while (1) 171 while (1)
172 { 172 {
173 /* Either process a partial fread() from this loop,
174 or the fread() in afalg_stream may have gotten EOF.
175 We need to avoid a subsequent fread() as EOF may
176 not be sticky. For details of such systems, see:
177 https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */
178 if (feof (stream))
179 goto process_partial_block;
180
173 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); 181 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
174 182
175 sum += n; 183 sum += n;
@@ -189,12 +197,6 @@ md5_stream (FILE *stream, void *resblock)
189 } 197 }
190 goto process_partial_block; 198 goto process_partial_block;
191 } 199 }
192
193 /* We've read at least one byte, so ignore errors. But always
194 check for EOF, since feof may be true even though N > 0.
195 Otherwise, we could end up calling fread after EOF. */
196 if (feof (stream))
197 goto process_partial_block;
198 } 200 }
199 201
200 /* Process buffer with BLOCKSIZE bytes. Note that 202 /* Process buffer with BLOCKSIZE bytes. Note that
diff --git a/lib/pselect.c b/lib/pselect.c
index 40758251ef3..33b2719561f 100644
--- a/lib/pselect.c
+++ b/lib/pselect.c
@@ -83,9 +83,9 @@ pselect (int nfds, fd_set *restrict rfds,
83 83
84int 84int
85rpl_pselect (int nfds, fd_set *restrict rfds, 85rpl_pselect (int nfds, fd_set *restrict rfds,
86 fd_set *restrict wfds, fd_set *restrict xfds, 86 fd_set *restrict wfds, fd_set *restrict xfds,
87 struct timespec const *restrict timeout, 87 struct timespec const *restrict timeout,
88 sigset_t const *restrict sigmask) 88 sigset_t const *restrict sigmask)
89{ 89{
90 int i; 90 int i;
91 91
diff --git a/lib/set-permissions.c b/lib/set-permissions.c
index 4b7371c9b4b..d42335aa502 100644
--- a/lib/set-permissions.c
+++ b/lib/set-permissions.c
@@ -229,14 +229,14 @@ set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod)
229 if (ret < 0 && errno != EINVAL && errno != ENOTSUP) 229 if (ret < 0 && errno != EINVAL && errno != ENOTSUP)
230 { 230 {
231 if (errno == ENOSYS) 231 if (errno == ENOSYS)
232 { 232 {
233 *must_chmod = true; 233 *must_chmod = true;
234 return 0; 234 return 0;
235 } 235 }
236 return -1; 236 return -1;
237 } 237 }
238 if (ret == 0) 238 if (ret == 0)
239 return 0; 239 return 0;
240 } 240 }
241# endif 241# endif
242 242
@@ -256,18 +256,18 @@ set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod)
256 256
257 if (desc != -1) 257 if (desc != -1)
258 ret = facl (desc, SETACL, 258 ret = facl (desc, SETACL,
259 sizeof (entries) / sizeof (aclent_t), entries); 259 sizeof (entries) / sizeof (aclent_t), entries);
260 else 260 else
261 ret = acl (name, SETACL, 261 ret = acl (name, SETACL,
262 sizeof (entries) / sizeof (aclent_t), entries); 262 sizeof (entries) / sizeof (aclent_t), entries);
263 if (ret < 0) 263 if (ret < 0)
264 { 264 {
265 if (errno == ENOSYS || errno == EOPNOTSUPP) 265 if (errno == ENOSYS || errno == EOPNOTSUPP)
266 { 266 {
267 *must_chmod = true; 267 *must_chmod = true;
268 return 0; 268 return 0;
269 } 269 }
270 return -1; 270 return -1;
271 } 271 }
272 return 0; 272 return 0;
273 } 273 }
@@ -483,7 +483,7 @@ context_acl_from_mode (struct permission_context *ctx)
483 483
484static int 484static int
485set_acls (struct permission_context *ctx, const char *name, int desc, 485set_acls (struct permission_context *ctx, const char *name, int desc,
486 int from_mode, bool *must_chmod, bool *acls_set) 486 int from_mode, bool *must_chmod, bool *acls_set)
487{ 487{
488 int ret = 0; 488 int ret = 0;
489 489
@@ -503,43 +503,43 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
503 if (! ctx->acls_not_supported) 503 if (! ctx->acls_not_supported)
504 { 504 {
505 if (ret == 0 && from_mode) 505 if (ret == 0 && from_mode)
506 { 506 {
507 if (ctx->acl) 507 if (ctx->acl)
508 acl_free (ctx->acl); 508 acl_free (ctx->acl);
509 ctx->acl = acl_from_mode (ctx->mode); 509 ctx->acl = acl_from_mode (ctx->mode);
510 if (ctx->acl == NULL) 510 if (ctx->acl == NULL)
511 ret = -1; 511 ret = -1;
512 } 512 }
513 513
514 if (ret == 0 && ctx->acl) 514 if (ret == 0 && ctx->acl)
515 { 515 {
516 if (HAVE_ACL_SET_FD && desc != -1) 516 if (HAVE_ACL_SET_FD && desc != -1)
517 ret = acl_set_fd (desc, ctx->acl); 517 ret = acl_set_fd (desc, ctx->acl);
518 else 518 else
519 ret = acl_set_file (name, ACL_TYPE_ACCESS, ctx->acl); 519 ret = acl_set_file (name, ACL_TYPE_ACCESS, ctx->acl);
520 if (ret != 0) 520 if (ret != 0)
521 { 521 {
522 if (! acl_errno_valid (errno)) 522 if (! acl_errno_valid (errno))
523 { 523 {
524 ctx->acls_not_supported = true; 524 ctx->acls_not_supported = true;
525 if (from_mode || acl_access_nontrivial (ctx->acl) == 0) 525 if (from_mode || acl_access_nontrivial (ctx->acl) == 0)
526 ret = 0; 526 ret = 0;
527 } 527 }
528 } 528 }
529 else 529 else
530 { 530 {
531 *acls_set = true; 531 *acls_set = true;
532 if (S_ISDIR(ctx->mode)) 532 if (S_ISDIR(ctx->mode))
533 { 533 {
534 if (! from_mode && ctx->default_acl && 534 if (! from_mode && ctx->default_acl &&
535 acl_default_nontrivial (ctx->default_acl)) 535 acl_default_nontrivial (ctx->default_acl))
536 ret = acl_set_file (name, ACL_TYPE_DEFAULT, 536 ret = acl_set_file (name, ACL_TYPE_DEFAULT,
537 ctx->default_acl); 537 ctx->default_acl);
538 else 538 else
539 ret = acl_delete_def_file (name); 539 ret = acl_delete_def_file (name);
540 } 540 }
541 } 541 }
542 } 542 }
543 } 543 }
544 544
545# if HAVE_ACL_TYPE_NFS4 /* FreeBSD */ 545# if HAVE_ACL_TYPE_NFS4 /* FreeBSD */
@@ -573,38 +573,38 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
573 573
574 /* Remove ACLs if the file has ACLs. */ 574 /* Remove ACLs if the file has ACLs. */
575 if (HAVE_ACL_GET_FD && desc != -1) 575 if (HAVE_ACL_GET_FD && desc != -1)
576 acl = acl_get_fd (desc); 576 acl = acl_get_fd (desc);
577 else 577 else
578 acl = acl_get_file (name, ACL_TYPE_EXTENDED); 578 acl = acl_get_file (name, ACL_TYPE_EXTENDED);
579 if (acl) 579 if (acl)
580 { 580 {
581 acl_free (acl); 581 acl_free (acl);
582 582
583 acl = acl_init (0); 583 acl = acl_init (0);
584 if (acl) 584 if (acl)
585 { 585 {
586 if (HAVE_ACL_SET_FD && desc != -1) 586 if (HAVE_ACL_SET_FD && desc != -1)
587 ret = acl_set_fd (desc, acl); 587 ret = acl_set_fd (desc, acl);
588 else 588 else
589 ret = acl_set_file (name, ACL_TYPE_EXTENDED, acl); 589 ret = acl_set_file (name, ACL_TYPE_EXTENDED, acl);
590 acl_free (acl); 590 acl_free (acl);
591 } 591 }
592 else 592 else
593 ret = -1; 593 ret = -1;
594 } 594 }
595 } 595 }
596 else 596 else
597 { 597 {
598 if (HAVE_ACL_SET_FD && desc != -1) 598 if (HAVE_ACL_SET_FD && desc != -1)
599 ret = acl_set_fd (desc, ctx->acl); 599 ret = acl_set_fd (desc, ctx->acl);
600 else 600 else
601 ret = acl_set_file (name, ACL_TYPE_EXTENDED, ctx->acl); 601 ret = acl_set_file (name, ACL_TYPE_EXTENDED, ctx->acl);
602 if (ret != 0) 602 if (ret != 0)
603 { 603 {
604 if (! acl_errno_valid (errno) 604 if (! acl_errno_valid (errno)
605 && ! acl_extended_nontrivial (ctx->acl)) 605 && ! acl_extended_nontrivial (ctx->acl))
606 ret = 0; 606 ret = 0;
607 } 607 }
608 } 608 }
609 *acls_set = true; 609 *acls_set = true;
610 610
@@ -626,34 +626,34 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
626 if (ret == 0 && ctx->count) 626 if (ret == 0 && ctx->count)
627 { 627 {
628 if (desc != -1) 628 if (desc != -1)
629 ret = facl (desc, SETACL, ctx->count, ctx->entries); 629 ret = facl (desc, SETACL, ctx->count, ctx->entries);
630 else 630 else
631 ret = acl (name, SETACL, ctx->count, ctx->entries); 631 ret = acl (name, SETACL, ctx->count, ctx->entries);
632 if (ret < 0) 632 if (ret < 0)
633 { 633 {
634 if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL) 634 if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
635 && acl_nontrivial (ctx->count, ctx->entries) == 0) 635 && acl_nontrivial (ctx->count, ctx->entries) == 0)
636 ret = 0; 636 ret = 0;
637 } 637 }
638 else 638 else
639 *acls_set = true; 639 *acls_set = true;
640 } 640 }
641 641
642# ifdef ACE_GETACL 642# ifdef ACE_GETACL
643 if (ret == 0 && ctx->ace_count) 643 if (ret == 0 && ctx->ace_count)
644 { 644 {
645 if (desc != -1) 645 if (desc != -1)
646 ret = facl (desc, ACE_SETACL, ctx->ace_count, ctx->ace_entries); 646 ret = facl (desc, ACE_SETACL, ctx->ace_count, ctx->ace_entries);
647 else 647 else
648 ret = acl (name, ACE_SETACL, ctx->ace_count, ctx->ace_entries); 648 ret = acl (name, ACE_SETACL, ctx->ace_count, ctx->ace_entries);
649 if (ret < 0) 649 if (ret < 0)
650 { 650 {
651 if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP) 651 if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP)
652 && acl_ace_nontrivial (ctx->ace_count, ctx->ace_entries) == 0) 652 && acl_ace_nontrivial (ctx->ace_count, ctx->ace_entries) == 0)
653 ret = 0; 653 ret = 0;
654 } 654 }
655 else 655 else
656 *acls_set = true; 656 *acls_set = true;
657 } 657 }
658# endif 658# endif
659 659
@@ -665,17 +665,17 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
665 if (ret == 0 && ctx->count > 0) 665 if (ret == 0 && ctx->count > 0)
666 { 666 {
667 if (desc != -1) 667 if (desc != -1)
668 ret = fsetacl (desc, ctx->count, ctx->entries); 668 ret = fsetacl (desc, ctx->count, ctx->entries);
669 else 669 else
670 ret = setacl (name, ctx->count, ctx->entries); 670 ret = setacl (name, ctx->count, ctx->entries);
671 if (ret < 0) 671 if (ret < 0)
672 { 672 {
673 if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP) 673 if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
674 && (from_mode || !acl_nontrivial (ctx->count, ctx->entries))) 674 && (from_mode || !acl_nontrivial (ctx->count, ctx->entries)))
675 ret = 0; 675 ret = 0;
676 } 676 }
677 else 677 else
678 *acls_set = true; 678 *acls_set = true;
679 } 679 }
680 680
681# if HAVE_ACLV_H 681# if HAVE_ACLV_H
@@ -686,13 +686,13 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
686 { 686 {
687 ret = acl ((char *) name, ACL_SET, ctx->aclv_count, ctx->aclv_entries); 687 ret = acl ((char *) name, ACL_SET, ctx->aclv_count, ctx->aclv_entries);
688 if (ret < 0) 688 if (ret < 0)
689 { 689 {
690 if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL) 690 if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
691 && (from_mode || !aclv_nontrivial (ctx->aclv_count, ctx->aclv_entries))) 691 && (from_mode || !aclv_nontrivial (ctx->aclv_count, ctx->aclv_entries)))
692 ret = 0; 692 ret = 0;
693 } 693 }
694 else 694 else
695 *acls_set = true; 695 *acls_set = true;
696 } 696 }
697# endif 697# endif
698 698
@@ -711,16 +711,16 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
711 if (ret == 0 && ctx->have_u) 711 if (ret == 0 && ctx->have_u)
712 { 712 {
713 if (desc != -1) 713 if (desc != -1)
714 ret = fchacl (desc, &ctx->u.a, ctx->u.a.acl_len); 714 ret = fchacl (desc, &ctx->u.a, ctx->u.a.acl_len);
715 else 715 else
716 ret = chacl ((char *) name, &ctx->u.a, ctx->u.a.acl_len); 716 ret = chacl ((char *) name, &ctx->u.a, ctx->u.a.acl_len);
717 if (ret < 0) 717 if (ret < 0)
718 { 718 {
719 if (errno == ENOSYS && from_mode) 719 if (errno == ENOSYS && from_mode)
720 ret = 0; 720 ret = 0;
721 } 721 }
722 else 722 else
723 *acls_set = true; 723 *acls_set = true;
724 } 724 }
725 725
726# elif HAVE_ACLSORT /* NonStop Kernel */ 726# elif HAVE_ACLSORT /* NonStop Kernel */
@@ -732,12 +732,12 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
732 { 732 {
733 ret = acl ((char *) name, ACL_SET, ctx->count, ctx->entries); 733 ret = acl ((char *) name, ACL_SET, ctx->count, ctx->entries);
734 if (ret != 0) 734 if (ret != 0)
735 { 735 {
736 if (!acl_nontrivial (ctx->count, ctx->entries)) 736 if (!acl_nontrivial (ctx->count, ctx->entries))
737 ret = 0; 737 ret = 0;
738 } 738 }
739 else 739 else
740 *acls_set = true; 740 *acls_set = true;
741 } 741 }
742 742
743# else /* No ACLs */ 743# else /* No ACLs */
@@ -805,7 +805,7 @@ set_permissions (struct permission_context *ctx, const char *name, int desc)
805 { 805 {
806 ret = chmod_or_fchmod (name, desc, ctx->mode); 806 ret = chmod_or_fchmod (name, desc, ctx->mode);
807 if (ret != 0) 807 if (ret != 0)
808 return -1; 808 return -1;
809 } 809 }
810 810
811#if USE_ACL 811#if USE_ACL
@@ -815,18 +815,18 @@ set_permissions (struct permission_context *ctx, const char *name, int desc)
815 int saved_errno = ret ? errno : 0; 815 int saved_errno = ret ? errno : 0;
816 816
817 /* If we can't set an acl which we expect to be able to set, try setting 817 /* If we can't set an acl which we expect to be able to set, try setting
818 the permissions to ctx->mode. Due to possible inherited permissions, 818 the permissions to ctx->mode. Due to possible inherited permissions,
819 we cannot simply chmod. */ 819 we cannot simply chmod. */
820 820
821 ret = set_acls (ctx, name, desc, true, &must_chmod, &acls_set); 821 ret = set_acls (ctx, name, desc, true, &must_chmod, &acls_set);
822 if (! acls_set) 822 if (! acls_set)
823 must_chmod = true; 823 must_chmod = true;
824 824
825 if (saved_errno) 825 if (saved_errno)
826 { 826 {
827 errno = saved_errno; 827 errno = saved_errno;
828 ret = -1; 828 ret = -1;
829 } 829 }
830 } 830 }
831#endif 831#endif
832 832
@@ -837,10 +837,10 @@ set_permissions (struct permission_context *ctx, const char *name, int desc)
837 ret = chmod_or_fchmod (name, desc, ctx->mode); 837 ret = chmod_or_fchmod (name, desc, ctx->mode);
838 838
839 if (saved_errno) 839 if (saved_errno)
840 { 840 {
841 errno = saved_errno; 841 errno = saved_errno;
842 ret = -1; 842 ret = -1;
843 } 843 }
844 } 844 }
845 845
846 return ret; 846 return ret;
diff --git a/lib/sha1.c b/lib/sha1.c
index 8306d887da5..cd79dfa8770 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -37,11 +37,11 @@
37# include "unlocked-io.h" 37# include "unlocked-io.h"
38#endif 38#endif
39 39
40#include <byteswap.h>
40#ifdef WORDS_BIGENDIAN 41#ifdef WORDS_BIGENDIAN
41# define SWAP(n) (n) 42# define SWAP(n) (n)
42#else 43#else
43# define SWAP(n) \ 44# define SWAP(n) bswap_32 (n)
44 (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
45#endif 45#endif
46 46
47#define BLOCKSIZE 32768 47#define BLOCKSIZE 32768
@@ -158,6 +158,14 @@ sha1_stream (FILE *stream, void *resblock)
158 /* Read block. Take care for partial reads. */ 158 /* Read block. Take care for partial reads. */
159 while (1) 159 while (1)
160 { 160 {
161 /* Either process a partial fread() from this loop,
162 or the fread() in afalg_stream may have gotten EOF.
163 We need to avoid a subsequent fread() as EOF may
164 not be sticky. For details of such systems, see:
165 https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */
166 if (feof (stream))
167 goto process_partial_block;
168
161 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); 169 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
162 170
163 sum += n; 171 sum += n;
@@ -177,12 +185,6 @@ sha1_stream (FILE *stream, void *resblock)
177 } 185 }
178 goto process_partial_block; 186 goto process_partial_block;
179 } 187 }
180
181 /* We've read at least one byte, so ignore errors. But always
182 check for EOF, since feof may be true even though N > 0.
183 Otherwise, we could end up calling fread after EOF. */
184 if (feof (stream))
185 goto process_partial_block;
186 } 188 }
187 189
188 /* Process buffer with BLOCKSIZE bytes. Note that 190 /* Process buffer with BLOCKSIZE bytes. Note that
diff --git a/lib/sha256.c b/lib/sha256.c
index a036befcafd..c518517077c 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -36,11 +36,11 @@
36# include "unlocked-io.h" 36# include "unlocked-io.h"
37#endif 37#endif
38 38
39#include <byteswap.h>
39#ifdef WORDS_BIGENDIAN 40#ifdef WORDS_BIGENDIAN
40# define SWAP(n) (n) 41# define SWAP(n) (n)
41#else 42#else
42# define SWAP(n) \ 43# define SWAP(n) bswap_32 (n)
43 (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
44#endif 44#endif
45 45
46#define BLOCKSIZE 32768 46#define BLOCKSIZE 32768
@@ -208,6 +208,14 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
208 /* Read block. Take care for partial reads. */ 208 /* Read block. Take care for partial reads. */
209 while (1) 209 while (1)
210 { 210 {
211 /* Either process a partial fread() from this loop,
212 or the fread() in afalg_stream may have gotten EOF.
213 We need to avoid a subsequent fread() as EOF may
214 not be sticky. For details of such systems, see:
215 https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */
216 if (feof (stream))
217 goto process_partial_block;
218
211 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); 219 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
212 220
213 sum += n; 221 sum += n;
@@ -227,12 +235,6 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
227 } 235 }
228 goto process_partial_block; 236 goto process_partial_block;
229 } 237 }
230
231 /* We've read at least one byte, so ignore errors. But always
232 check for EOF, since feof may be true even though N > 0.
233 Otherwise, we could end up calling fread after EOF. */
234 if (feof (stream))
235 goto process_partial_block;
236 } 238 }
237 239
238 /* Process buffer with BLOCKSIZE bytes. Note that 240 /* Process buffer with BLOCKSIZE bytes. Note that
diff --git a/lib/sha512.c b/lib/sha512.c
index e175e705f52..e854951eb31 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -36,18 +36,11 @@
36# include "unlocked-io.h" 36# include "unlocked-io.h"
37#endif 37#endif
38 38
39#include <byteswap.h>
39#ifdef WORDS_BIGENDIAN 40#ifdef WORDS_BIGENDIAN
40# define SWAP(n) (n) 41# define SWAP(n) (n)
41#else 42#else
42# define SWAP(n) \ 43# define SWAP(n) bswap_64 (n)
43 u64or (u64or (u64or (u64shl (n, 56), \
44 u64shl (u64and (n, u64lo (0x0000ff00)), 40)), \
45 u64or (u64shl (u64and (n, u64lo (0x00ff0000)), 24), \
46 u64shl (u64and (n, u64lo (0xff000000)), 8))), \
47 u64or (u64or (u64and (u64shr (n, 8), u64lo (0xff000000)), \
48 u64and (u64shr (n, 24), u64lo (0x00ff0000))), \
49 u64or (u64and (u64shr (n, 40), u64lo (0x0000ff00)), \
50 u64shr (n, 56))))
51#endif 44#endif
52 45
53#define BLOCKSIZE 32768 46#define BLOCKSIZE 32768
@@ -216,6 +209,14 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
216 /* Read block. Take care for partial reads. */ 209 /* Read block. Take care for partial reads. */
217 while (1) 210 while (1)
218 { 211 {
212 /* Either process a partial fread() from this loop,
213 or the fread() in afalg_stream may have gotten EOF.
214 We need to avoid a subsequent fread() as EOF may
215 not be sticky. For details of such systems, see:
216 https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */
217 if (feof (stream))
218 goto process_partial_block;
219
219 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); 220 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
220 221
221 sum += n; 222 sum += n;
@@ -235,12 +236,6 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
235 } 236 }
236 goto process_partial_block; 237 goto process_partial_block;
237 } 238 }
238
239 /* We've read at least one byte, so ignore errors. But always
240 check for EOF, since feof may be true even though N > 0.
241 Otherwise, we could end up calling fread after EOF. */
242 if (feof (stream))
243 goto process_partial_block;
244 } 239 }
245 240
246 /* Process buffer with BLOCKSIZE bytes. Note that 241 /* Process buffer with BLOCKSIZE bytes. Note that
diff --git a/lib/time.in.h b/lib/time.in.h
index a2dca89340c..cda16c69d2c 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -212,7 +212,7 @@ _GL_CXXALIASWARN (gmtime_r);
212# define localtime rpl_localtime 212# define localtime rpl_localtime
213# endif 213# endif
214_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) 214_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
215 _GL_ARG_NONNULL ((1))); 215 _GL_ARG_NONNULL ((1)));
216_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); 216_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
217# else 217# else
218_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); 218_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index d3a8910ecfc..c9f5a6da5df 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -108,7 +108,7 @@ AC_DEFUN([gl_PREREQ_GETLOADAVG],
108[ 108[
109# Figure out what our getloadavg.c needs. 109# Figure out what our getloadavg.c needs.
110 110
111AC_CHECK_HEADERS_ONCE([sys/param.h]) 111AC_CHECK_HEADERS_ONCE([sys/param.h unistd.h])
112 112
113# On HPUX9, an unprivileged user can get load averages this way. 113# On HPUX9, an unprivileged user can get load averages this way.
114if test $gl_func_getloadavg_done = no; then 114if test $gl_func_getloadavg_done = no; then
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 736e421016c..5f07855acf1 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -354,16 +354,16 @@ AC_DEFUN([AC_C_RESTRICT],
354 for ac_kw in __restrict __restrict__ _Restrict restrict; do 354 for ac_kw in __restrict __restrict__ _Restrict restrict; do
355 AC_COMPILE_IFELSE( 355 AC_COMPILE_IFELSE(
356 [AC_LANG_PROGRAM( 356 [AC_LANG_PROGRAM(
357 [[typedef int *int_ptr; 357 [[typedef int *int_ptr;
358 int foo (int_ptr $ac_kw ip) { return ip[0]; } 358 int foo (int_ptr $ac_kw ip) { return ip[0]; }
359 int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ 359 int bar (int [$ac_kw]); /* Catch GCC bug 14050. */
360 int bar (int ip[$ac_kw]) { return ip[0]; } 360 int bar (int ip[$ac_kw]) { return ip[0]; }
361 ]], 361 ]],
362 [[int s[1]; 362 [[int s[1];
363 int *$ac_kw t = s; 363 int *$ac_kw t = s;
364 t[0] = 0; 364 t[0] = 0;
365 return foo (t) + bar (t); 365 return foo (t) + bar (t);
366 ]])], 366 ]])],
367 [ac_cv_c_restrict=$ac_kw]) 367 [ac_cv_c_restrict=$ac_kw])
368 test "$ac_cv_c_restrict" != no && break 368 test "$ac_cv_c_restrict" != no && break
369 done 369 done
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 60c0e4051cb..925c40e139a 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,4 +1,4 @@
1# manywarnings.m4 serial 14 1# manywarnings.m4 serial 15
2dnl Copyright (C) 2008-2018 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -108,12 +108,11 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
108 # comm -3 \ 108 # comm -3 \
109 # <((sed -n 's/^ *\(-[^ 0-9][^ ]*\) .*/\1/p' manywarnings.m4; \ 109 # <((sed -n 's/^ *\(-[^ 0-9][^ ]*\) .*/\1/p' manywarnings.m4; \
110 # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \ 110 # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
111 # <(gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort) 111 # <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort)
112 112
113 gl_manywarn_set= 113 gl_manywarn_set=
114 for gl_manywarn_item in -fno-common \ 114 for gl_manywarn_item in -fno-common \
115 -W \ 115 -W \
116 -Wabi \
117 -Waddress \ 116 -Waddress \
118 -Waggressive-loop-optimizations \ 117 -Waggressive-loop-optimizations \
119 -Wall \ 118 -Wall \
@@ -128,7 +127,6 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
128 -Wcast-align=strict \ 127 -Wcast-align=strict \
129 -Wcast-function-type \ 128 -Wcast-function-type \
130 -Wchar-subscripts \ 129 -Wchar-subscripts \
131 -Wchkp \
132 -Wclobbered \ 130 -Wclobbered \
133 -Wcomment \ 131 -Wcomment \
134 -Wcomments \ 132 -Wcomments \
@@ -176,7 +174,6 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
176 -Wint-to-pointer-cast \ 174 -Wint-to-pointer-cast \
177 -Winvalid-memory-model \ 175 -Winvalid-memory-model \
178 -Winvalid-pch \ 176 -Winvalid-pch \
179 -Wjump-misses-init \
180 -Wlogical-not-parentheses \ 177 -Wlogical-not-parentheses \
181 -Wlogical-op \ 178 -Wlogical-op \
182 -Wmain \ 179 -Wmain \
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
index a33b433c0ef..585b80a40ff 100644
--- a/m4/pthread_sigmask.m4
+++ b/m4/pthread_sigmask.m4
@@ -124,41 +124,41 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
124 case " $LIBS " in 124 case " $LIBS " in
125 *' -pthread '*) ;; 125 *' -pthread '*) ;;
126 *' -lpthread '*) ;; 126 *' -lpthread '*) ;;
127 *) 127 *)
128 AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread], 128 AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread],
129 [gl_cv_func_pthread_sigmask_in_libc_works], 129 [gl_cv_func_pthread_sigmask_in_libc_works],
130 [ 130 [
131 AC_RUN_IFELSE( 131 AC_RUN_IFELSE(
132 [AC_LANG_SOURCE([[ 132 [AC_LANG_SOURCE([[
133 #include <pthread.h> 133 #include <pthread.h>
134 #include <signal.h> 134 #include <signal.h>
135 #include <stddef.h> 135 #include <stddef.h>
136 int main () 136 int main ()
137 { 137 {
138 sigset_t set; 138 sigset_t set;
139 sigemptyset (&set); 139 sigemptyset (&set);
140 return pthread_sigmask (1729, &set, NULL) != 0; 140 return pthread_sigmask (1729, &set, NULL) != 0;
141 }]])], 141 }]])],
142 [gl_cv_func_pthread_sigmask_in_libc_works=no], 142 [gl_cv_func_pthread_sigmask_in_libc_works=no],
143 [gl_cv_func_pthread_sigmask_in_libc_works=yes], 143 [gl_cv_func_pthread_sigmask_in_libc_works=yes],
144 [ 144 [
145 changequote(,)dnl 145 changequote(,)dnl
146 case "$host_os" in 146 case "$host_os" in
147 freebsd* | hpux* | solaris | solaris2.[2-9]*) 147 freebsd* | hpux* | solaris | solaris2.[2-9]*)
148 gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; 148 gl_cv_func_pthread_sigmask_in_libc_works="guessing no";;
149 *) 149 *)
150 gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; 150 gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";;
151 esac 151 esac
152 changequote([,])dnl 152 changequote([,])dnl
153 ]) 153 ])
154 ]) 154 ])
155 case "$gl_cv_func_pthread_sigmask_in_libc_works" in 155 case "$gl_cv_func_pthread_sigmask_in_libc_works" in
156 *no) 156 *no)
157 REPLACE_PTHREAD_SIGMASK=1 157 REPLACE_PTHREAD_SIGMASK=1
158 AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1], 158 AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1],
159 [Define to 1 if pthread_sigmask may return 0 and have no effect.]) 159 [Define to 1 if pthread_sigmask may return 0 and have no effect.])
160 ;; 160 ;;
161 esac;; 161 esac;;
162 esac 162 esac
163 fi 163 fi
164 164
diff --git a/m4/vararrays.m4 b/m4/vararrays.m4
index 329eb490c3c..17563b519b0 100644
--- a/m4/vararrays.m4
+++ b/m4/vararrays.m4
@@ -18,44 +18,44 @@ AC_DEFUN([AC_C_VARARRAYS],
18 ac_cv_c_vararrays, 18 ac_cv_c_vararrays,
19 [AC_EGREP_CPP([defined], 19 [AC_EGREP_CPP([defined],
20 [#ifdef __STDC_NO_VLA__ 20 [#ifdef __STDC_NO_VLA__
21 defined 21 defined
22 #endif 22 #endif
23 ], 23 ],
24 [ac_cv_c_vararrays='no: __STDC_NO_VLA__ is defined'], 24 [ac_cv_c_vararrays='no: __STDC_NO_VLA__ is defined'],
25 [AC_COMPILE_IFELSE( 25 [AC_COMPILE_IFELSE(
26 [AC_LANG_PROGRAM( 26 [AC_LANG_PROGRAM(
27 [[/* Test for VLA support. This test is partly inspired 27 [[/* Test for VLA support. This test is partly inspired
28 from examples in the C standard. Use at least two VLA 28 from examples in the C standard. Use at least two VLA
29 functions to detect the GCC 3.4.3 bug described in: 29 functions to detect the GCC 3.4.3 bug described in:
30 https://lists.gnu.org/r/bug-gnulib/2014-08/msg00014.html 30 https://lists.gnu.org/r/bug-gnulib/2014-08/msg00014.html
31 */ 31 */
32 #ifdef __STDC_NO_VLA__ 32 #ifdef __STDC_NO_VLA__
33 syntax error; 33 syntax error;
34 #else 34 #else
35 extern int n; 35 extern int n;
36 int B[100]; 36 int B[100];
37 int fvla (int m, int C[m][m]); 37 int fvla (int m, int C[m][m]);
38 38
39 int 39 int
40 simple (int count, int all[static count]) 40 simple (int count, int all[static count])
41 { 41 {
42 return all[count - 1]; 42 return all[count - 1];
43 } 43 }
44 44
45 int 45 int
46 fvla (int m, int C[m][m]) 46 fvla (int m, int C[m][m])
47 { 47 {
48 typedef int VLA[m][m]; 48 typedef int VLA[m][m];
49 VLA x; 49 VLA x;
50 int D[m]; 50 int D[m];
51 static int (*q)[m] = &B; 51 static int (*q)[m] = &B;
52 int (*s)[n] = q; 52 int (*s)[n] = q;
53 return C && &x[0][0] == &D[0] && &D[0] == s[0]; 53 return C && &x[0][0] == &D[0] && &D[0] == s[0];
54 } 54 }
55 #endif 55 #endif
56 ]])], 56 ]])],
57 [ac_cv_c_vararrays=yes], 57 [ac_cv_c_vararrays=yes],
58 [ac_cv_c_vararrays=no])])]) 58 [ac_cv_c_vararrays=no])])])
59 if test "$ac_cv_c_vararrays" = yes; then 59 if test "$ac_cv_c_vararrays" = yes; then
60 dnl This is for compatibility with Autoconf 2.61-2.69. 60 dnl This is for compatibility with Autoconf 2.61-2.69.
61 AC_DEFINE([HAVE_C_VARARRAYS], 1, 61 AC_DEFINE([HAVE_C_VARARRAYS], 1,