diff options
author | unknown <knielsen@knielsen-hq.org> | 2009-10-15 23:38:29 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2009-10-15 23:38:29 +0200 |
commit | 6aad537a6aa1381b73e87e53a5a17eda4ef1d452 (patch) | |
tree | 9366ff2dea102dc28d90ffad1cf8dff3039650e0 /cmd-line-utils/readline/histfile.c | |
parent | 8ea19fa73e86a3c27917a92affd6a9e43763c7ce (diff) | |
parent | c7d32876f345785580a7cf286542ccf390b4e1fa (diff) | |
download | mariadb-git-6aad537a6aa1381b73e87e53a5a17eda4ef1d452.tar.gz |
Merge MySQL 5.1.39 into MariaDB 5.1.
Diffstat (limited to 'cmd-line-utils/readline/histfile.c')
-rw-r--r-- | cmd-line-utils/readline/histfile.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd-line-utils/readline/histfile.c b/cmd-line-utils/readline/histfile.c index 118c5ebd328..cbd367542ce 100644 --- a/cmd-line-utils/readline/histfile.c +++ b/cmd-line-utils/readline/histfile.c @@ -186,7 +186,7 @@ read_history_range (filename, from, to) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ -if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || file_size + 1 < file_size) { errno = overflow_errno; @@ -311,6 +311,7 @@ history_truncate_file (fname, lines) int file, chars_read, rv; struct stat finfo; size_t file_size; + size_t bytes_written; buffer = (char *)NULL; filename = history_filename (fname); @@ -340,7 +341,7 @@ history_truncate_file (fname, lines) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ -if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || file_size + 1 < file_size) { close (file); @@ -400,7 +401,7 @@ if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || truncate to. */ if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) { - write (file, bp, chars_read - (bp - buffer)); + bytes_written= write (file, bp, chars_read - (bp - buffer)); #if defined (__BEOS__) /* BeOS ignores O_TRUNC. */ |