diff options
author | Jari Aalto <jari.aalto@cante.net> | 1999-02-19 17:11:39 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:52 +0000 |
commit | b72432fdcc59300c6fe7c9d6c8a31ad3447933f5 (patch) | |
tree | b9899162338c2ff3fd83a8aef8831cb119e85cd7 /lib/readline/histfile.c | |
parent | bc4cd23ce958feda898c618215f94d8a4e8f4ffa (diff) | |
download | android_external_bash-b72432fdcc59300c6fe7c9d6c8a31ad3447933f5.tar.gz android_external_bash-b72432fdcc59300c6fe7c9d6c8a31ad3447933f5.tar.bz2 android_external_bash-b72432fdcc59300c6fe7c9d6c8a31ad3447933f5.zip |
Imported from ../bash-2.03.tar.gz.
Diffstat (limited to 'lib/readline/histfile.c')
-rw-r--r-- | lib/readline/histfile.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c index 81dda57..3325b7f 100644 --- a/lib/readline/histfile.c +++ b/lib/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); } |