aboutsummaryrefslogtreecommitdiff
path: root/contrib/libreadline/histfile.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1999-05-28 01:59:23 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1999-05-28 01:59:23 +0000
commitf5b6c9d1edd4cd430eea9dfdf45288e2d6048a5e (patch)
treeb727625e73f35f475e06719785a6f7a2d5126754 /contrib/libreadline/histfile.c
parent91d01d1fdf0be5e6ac81f6fc42a05a1ee1c1ef05 (diff)
downloadsrc-f5b6c9d1edd4cd430eea9dfdf45288e2d6048a5e.tar.gz
src-f5b6c9d1edd4cd430eea9dfdf45288e2d6048a5e.zip
readline v4.0
Notes
Notes: svn path=/vendor/libreadline/dist/; revision=47558
Diffstat (limited to 'contrib/libreadline/histfile.c')
-rw-r--r--contrib/libreadline/histfile.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/libreadline/histfile.c b/contrib/libreadline/histfile.c
index 81dda57d0fe6..3325b7fc1f71 100644
--- a/contrib/libreadline/histfile.c
+++ b/contrib/libreadline/histfile.c
@@ -155,7 +155,11 @@ read_history_range (filename, from, to)
}
buffer = xmalloc (file_size + 1);
+#if 0
if (read (file, buffer, file_size) != file_size)
+#else
+ if (read (file, buffer, file_size) < 0)
+#endif
{
error_and_exit:
if (file >= 0)
@@ -217,7 +221,7 @@ read_history_range (filename, from, to)
int
history_truncate_file (fname, lines)
char *fname;
- register int lines;
+ int lines;
{
register int i;
int file, chars_read;
@@ -276,6 +280,12 @@ history_truncate_file (fname, lines)
if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{
write (file, buffer + i, file_size - i);
+
+#if defined (__BEOS__)
+ /* BeOS ignores O_TRUNC. */
+ ftruncate (file, file_size - i);
+#endif
+
close (file);
}