diff options
author | David Lehman <dlehman@redhat.com> | 2012-10-04 13:08:30 -0500 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2012-10-05 12:10:34 -0500 |
commit | 6016f6468acad5e47f6e96253dcf74cd1688342f (patch) | |
tree | 7f424ba4c0d28680f8bc757939fadcfc23e3728b /pyanaconda/storage | |
parent | cb12b20db216024b7f67aef93d0cabdbf13cb01c (diff) | |
download | anaconda-6016f6468acad5e47f6e96253dcf74cd1688342f.tar.gz anaconda-6016f6468acad5e47f6e96253dcf74cd1688342f.tar.xz anaconda-6016f6468acad5e47f6e96253dcf74cd1688342f.zip |
Prevent negative free value for filesystems. (#861812)
I wonder if we should even continue to pad the reported ntfs min size
by 250MB. Seems pretty crusty to me.
Diffstat (limited to 'pyanaconda/storage')
-rw-r--r-- | pyanaconda/storage/formats/fs.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pyanaconda/storage/formats/fs.py b/pyanaconda/storage/formats/fs.py index c4f693c3d..70faf04df 100644 --- a/pyanaconda/storage/formats/fs.py +++ b/pyanaconda/storage/formats/fs.py @@ -315,7 +315,7 @@ class FS(DeviceFormat): if self.exists: if self.currentSize and self.minSize and \ self.currentSize != self.minSize: - free = int(self.currentSize - self.minSize) # truncate + free = int(max(0, self.currentSize - self.minSize)) # truncate return free @@ -1383,8 +1383,8 @@ class NTFS(FS): if not l.startswith("Minsize"): continue try: - min = l.split(":")[1].strip() - minSize = int(min) + 250 + _min = l.split(":")[1].strip() + minSize = min(self.currentSize, int(_min) + 250) except (IndexError, ValueError) as e: minSize = None log.warning("Unable to parse output for minimum size on %s: %s" %(self.device, e)) |