From: Nick Ing-Simmons Date: Tue, 17 Feb 1998 13:19:18 +0000 (+0000) Subject: DB_File ->length does not work just after tie. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6c5989e9d8ff294ed369afe5749cd5b1711c88c5;p=p5sagit%2Fp5-mst-13.2.git DB_File ->length does not work just after tie. p4raw-id: //depot/perl@553 --- diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs index 91b4dc2..b6da386 100644 --- a/ext/DB_File/DB_File.xs +++ b/ext/DB_File/DB_File.xs @@ -533,6 +533,14 @@ DB_File db ; DBT_flags(key) ; DBT_flags(value) ; RETVAL = do_SEQ(db, key, value, R_LAST) ; + if (RETVAL < 0 && errno == EBADF) + { + recno_t oops = -1; + key.data = &oops; + key.size = sizeof(oops); + db_get(db, key, value, 0); + RETVAL = do_SEQ(db, key, value, R_LAST) ; + } if (RETVAL == 0) RETVAL = *(I32 *)key.data ; else /* No key means empty file */