Patch #755087: Deal with emptied dumbdbm files correctly.
This commit is contained in:
parent
171be76bdd
commit
5b8bfdf67c
|
@ -51,10 +51,10 @@ def whichdb(filename):
|
||||||
# Check for dumbdbm next -- this has a .dir and and a .dat file
|
# Check for dumbdbm next -- this has a .dir and and a .dat file
|
||||||
try:
|
try:
|
||||||
# First check for presence of files
|
# First check for presence of files
|
||||||
sizes = os.stat(filename + os.extsep + "dat").st_size, \
|
os.stat(filename + os.extsep + "dat")
|
||||||
os.stat(filename + os.extsep + "dir").st_size
|
size = os.stat(filename + os.extsep + "dir").st_size
|
||||||
# dumbdbm files with no keys are empty
|
# dumbdbm files with no keys are empty
|
||||||
if sizes == (0, 0):
|
if size == 0:
|
||||||
return "dumbdbm"
|
return "dumbdbm"
|
||||||
f = open(filename + os.extsep + "dir", "rb")
|
f = open(filename + os.extsep + "dir", "rb")
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue