cvs: php4 /ext/dbase dbf_rec.c
| From: | Vlad Krupin | Date: | Mon, 31 Dec 2001 12:52:34 +0000 |
| Subject: | cvs: php4 /ext/dbase dbf_rec.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-8881@lists.php.net to get a copy of this message | ||
vlad Mon Dec 31 07:52:34 2001 EDT
Modified files:
/php4/ext/dbase dbf_rec.c
Log:
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)
Index: php4/ext/dbase/dbf_rec.c
diff -u php4/ext/dbase/dbf_rec.c:1.3 php4/ext/dbase/dbf_rec.c:1.4
--- php4/ext/dbase/dbf_rec.c:1.3 Sun Sep 9 09:28:46 2001
+++ php4/ext/dbase/dbf_rec.c Mon Dec 31 07:52:34 2001
@@ -125,6 +125,12 @@
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;
}