X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fbup%2Findex.py;h=10f83098e1d733aadd0c85618b91eb4dd97a4654;hb=4cb8d3c09194109eb145428002df9e392f9ec7d5;hp=460a52f18de76f5bb60a2ccf45329a83e03f8e14;hpb=56dd4712e7d66a8623ec7b85753469f9500c6003;p=bup.git diff --git a/lib/bup/index.py b/lib/bup/index.py index 460a52f..10f8309 100644 --- a/lib/bup/index.py +++ b/lib/bup/index.py @@ -120,14 +120,16 @@ class Entry: self.gid += 0x100000000 assert(self.uid >= 0) assert(self.gid >= 0) - if self.mtime < -0x80000000: # can happen in NTFS on 64-bit linux - self.mtime = 0 - if self.ctime < -0x80000000: - self.ctime = 0 - if self.mtime > 0x7fffffff: - self.mtime = 0x7fffffff - if self.ctime > 0x7fffffff: - self.ctime = 0x7fffffff + self.mtime = self._fixup_time(self.mtime) + self.ctime = self._fixup_time(self.ctime) + + def _fixup_time(self, t): + if t < -0x80000000: # can happen in NTFS on 64-bit linux + return 0 + elif t > 0x7fffffff: + return 0x7fffffff + else: + return t def is_valid(self): f = IX_HASHVALID|IX_EXISTS