summaryrefslogtreecommitdiff
path: root/lib/safe-read.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2021-01-20 21:52:54 +0100
committerAndy Wingo <wingo@pobox.com>2021-01-20 23:03:56 +0100
commita91b95cca2d397c84f8b9bbd602d40209a7092ce (patch)
tree2c286a291f5a2b812d6e216be10936f2709d59cf /lib/safe-read.c
parent758b31994cff582c7e8785b4cc2240dbf3573837 (diff)
downloadguile-a91b95cca2d397c84f8b9bbd602d40209a7092ce.tar.gz
Update Gnulib to v0.1-4379-g2ef5a9b4b
Also bump required autoconf version to 2.64, as required by Gnulib.
Diffstat (limited to 'lib/safe-read.c')
-rw-r--r--lib/safe-read.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/safe-read.c b/lib/safe-read.c
index bf9d7be7c..a4a1b089d 100644
--- a/lib/safe-read.c
+++ b/lib/safe-read.c
@@ -1,6 +1,6 @@
/* An interface to read and write that retries after interrupts.
- Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2017 Free Software
+ Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2021 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -14,7 +14,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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>
@@ -37,7 +37,7 @@
# define IS_EINTR(x) 0
#endif
-#include <limits.h>
+#include "sys-limits.h"
#ifdef SAFE_WRITE
# define safe_rw safe_write
@@ -55,12 +55,6 @@
size_t
safe_rw (int fd, void const *buf, size_t count)
{
- /* Work around a bug in Tru64 5.1. Attempting to read more than
- INT_MAX bytes fails with errno == EINVAL. See
- <http://lists.gnu.org/archive/html/bug-gnu-utils/2002-04/msg00010.html>.
- When decreasing COUNT, keep it block-aligned. */
- enum { BUGGY_READ_MAXIMUM = INT_MAX & ~8191 };
-
for (;;)
{
ssize_t result = rw (fd, buf, count);
@@ -69,8 +63,8 @@ safe_rw (int fd, void const *buf, size_t count)
return result;
else if (IS_EINTR (errno))
continue;
- else if (errno == EINVAL && BUGGY_READ_MAXIMUM < count)
- count = BUGGY_READ_MAXIMUM;
+ else if (errno == EINVAL && SYS_BUFSIZE_MAX < count)
+ count = SYS_BUFSIZE_MAX;
else
return result;
}