summaryrefslogtreecommitdiffstats
path: root/fsset.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2004-09-27 19:29:59 +0000
committerJeremy Katz <katzj@redhat.com>2004-09-27 19:29:59 +0000
commit7e18ebe28650324292a6911f12763a9f61f6f6fa (patch)
tree54359a22a52690f9f8b1a8a9c82e20e4fd7ba855 /fsset.py
parent367ca94f3875d4ce8f60c46a3f1a02fdfab1a133 (diff)
downloadanaconda-7e18ebe28650324292a6911f12763a9f61f6f6fa.tar.gz
anaconda-7e18ebe28650324292a6911f12763a9f61f6f6fa.tar.xz
anaconda-7e18ebe28650324292a6911f12763a9f61f6f6fa.zip
2004-09-27 Jeremy Katz <katzj@redhat.com>
* fsset.py (swapFileSystem.mount): Skip version 0 swaps (#122101)
Diffstat (limited to 'fsset.py')
-rw-r--r--fsset.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/fsset.py b/fsset.py
index 832ce2bd6..fadab7733 100644
--- a/fsset.py
+++ b/fsset.py
@@ -696,6 +696,26 @@ class swapFileSystem(FileSystemType):
self.supported = 1
def mount(self, device, mountpoint, readOnly=0, bindMount=0):
+ pagesize = isys.getpagesize()
+ buf = None
+ if pagesize > 2048:
+ num = pagesize
+ else:
+ num = 2048
+ try:
+ fd = os.open(dev, os.O_RDONLY)
+ buf = os.read(fd, num)
+ os.close(fd)
+ except:
+ pass
+
+ # FIXME: we should ask if they want to reinitialize swaps that
+ # are of format 0 (#122101)
+ if buf is not None and len(buf) == pagesize:
+ if buf[pagesize - 10:] == "SWAP-SPACE":
+ log("SWAP is of format 0, skipping it")
+ return
+
isys.swapon (device)
def umount(self, device, path):