summaryrefslogtreecommitdiff
path: root/readline/histfile.c
diff options
context:
space:
mode:
authorJason Molenda <jsm@bugshack.cygnus.com>1999-08-02 23:48:37 +0000
committerJason Molenda <jsm@bugshack.cygnus.com>1999-08-02 23:48:37 +0000
commit6da787a878c938e680f13808dee254beacefbd43 (patch)
tree7c7b4d4f6655b210e33ca51f656f4552c9326ed3 /readline/histfile.c
parent1392c9fbbf6fe8811e5374356b7fdf3b389068ab (diff)
downloadgdb-6da787a878c938e680f13808dee254beacefbd43.tar.gz
import gdb-1999-08-02 snapshot
Diffstat (limited to 'readline/histfile.c')
-rw-r--r--readline/histfile.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/readline/histfile.c b/readline/histfile.c
index 81dda57d0fe..3325b7fc1f7 100644
--- a/readline/histfile.c
+++ b/readline/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);
}