mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #9156 from jacksontj/develop
Fix infinite recursion when a file is invalid (corrupted, empty, or mid-write)
This commit is contained in:
commit
013945755a
@ -191,6 +191,8 @@ def file_hash(load, fnd):
|
||||
hsum, mtime = fp_.read().split(':')
|
||||
except ValueError:
|
||||
log.debug('Fileserver attempted to read incomplete cache file. Retrying.')
|
||||
# Delete the file since its incomplete (either corrupted or incomplete)
|
||||
os.unlink(cache_path)
|
||||
file_hash(load, fnd)
|
||||
return(ret)
|
||||
if os.path.getmtime(path) == mtime:
|
||||
@ -199,6 +201,8 @@ def file_hash(load, fnd):
|
||||
return ret
|
||||
except os.error: # Can't use Python select() because we need Windows support
|
||||
log.debug("Fileserver encountered lock when reading cache file. Retrying.")
|
||||
# Delete the file since its incomplete (either corrupted or incomplete)
|
||||
os.unlink(cache_path)
|
||||
file_hash(load, fnd)
|
||||
return(ret)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user