diff options
| author | Vlad Krupin <vlad@php.net> | 2001-12-31 12:52:34 +0000 |
|---|---|---|
| committer | Vlad Krupin <vlad@php.net> | 2001-12-31 12:52:34 +0000 |
| commit | 543077d9153900fc13b00829bba7e345459175f0 (patch) | |
| tree | ea5c18187d2643fad072455702fddb38d7add400 /ext/dbase | |
| parent | 2f0cd79621ffc21f9fd1aa50d6eb497a1f59b879 (diff) | |
| download | php-git-543077d9153900fc13b00829bba7e345459175f0.tar.gz | |
Now dbase_pack() actually truncates the resulting .dbf file to the right
size (possibly fixing bug #6852 #3).
@Make dbase_pack() truncate the file to the right size. (Vlad)
Diffstat (limited to 'ext/dbase')
| -rw-r--r-- | ext/dbase/dbf_rec.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/dbase/dbf_rec.c b/ext/dbase/dbf_rec.c index 44d90b69d2..11ee63b107 100644 --- a/ext/dbase/dbf_rec.c +++ b/ext/dbase/dbf_rec.c @@ -125,6 +125,12 @@ void pack_dbf(dbhead_t *dbh) rec_cnt--; } free(cp); + + /* Try to truncate the file to the right size. */ + if (ftruncate(dbh->db_fd, out_off) != 0) { + php_error(E_WARNING, "dbase_pack() couldn't truncate the file to the right size. Some deleted records may still be left in there."); + } + if (rec_cnt == 0) dbh->db_records = new_cnt; } |
