DB_File ->length does not work just after tie.
Nick Ing-Simmons [Tue, 17 Feb 1998 13:19:18 +0000 (13:19 +0000)]
p4raw-id: //depot/perl@553

ext/DB_File/DB_File.xs

index 91b4dc2..b6da386 100644 (file)
@@ -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 */