diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-08-02 23:48:02 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-08-02 23:48:02 +0000 |
commit | c862e87b3ec8647ab6c1bb08443088ea81c74225 (patch) | |
tree | 8e5828b091fea3257c7ffc20a5c95f1d62b93267 /readline/histfile.c | |
parent | c95b01a9b04837dbfc8986afbbccc4c7d2b4ebf8 (diff) | |
download | gdb-c862e87b3ec8647ab6c1bb08443088ea81c74225.zip gdb-c862e87b3ec8647ab6c1bb08443088ea81c74225.tar.gz gdb-c862e87b3ec8647ab6c1bb08443088ea81c74225.tar.bz2 |
import gdb-1999-08-02 snapshot
Diffstat (limited to 'readline/histfile.c')
-rw-r--r-- | readline/histfile.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/readline/histfile.c b/readline/histfile.c index 81dda57..3325b7f 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); } |