ia64/xen-unstable

changeset 11560:587735fb18ab

Pygrub: stop the FS identification code from leaking open fds.
Signed-off-by: Tim Deegan <tim.deegn@xensource.com>
author Tim Deegan <tim.deegan@xensource.com>
date Thu Sep 21 14:55:02 2006 +0100 (2006-09-21)
parents 93135bbb5344
children 16e4a5a7cfd7
files tools/pygrub/src/fsys/ext2/__init__.py tools/pygrub/src/fsys/reiser/__init__.py
line diff
     1.1 --- a/tools/pygrub/src/fsys/ext2/__init__.py	Thu Sep 21 11:33:38 2006 +0100
     1.2 +++ b/tools/pygrub/src/fsys/ext2/__init__.py	Thu Sep 21 14:55:02 2006 +0100
     1.3 @@ -23,7 +23,7 @@ class Ext2FileSystemType(FileSystemType)
     1.4          fd = os.open(fn, os.O_RDONLY)
     1.5          os.lseek(fd, offset, 0)
     1.6          buf = os.read(fd, 2048)
     1.7 -        
     1.8 +        os.close(fd)        
     1.9          if len(buf) > 1082 and \
    1.10                 struct.unpack("<H", buf[1080:1082]) == (0xef53,):
    1.11              return True
     2.1 --- a/tools/pygrub/src/fsys/reiser/__init__.py	Thu Sep 21 11:33:38 2006 +0100
     2.2 +++ b/tools/pygrub/src/fsys/reiser/__init__.py	Thu Sep 21 14:55:02 2006 +0100
     2.3 @@ -26,6 +26,7 @@ class ReiserFileSystemType(FileSystemTyp
     2.4          fd = os.open(fn, os.O_RDONLY)
     2.5          os.lseek(fd, 0x10000, 0)
     2.6          buf = os.read(fd, 0x40)
     2.7 +        os.close(fd)
     2.8          if len(buf) == 0x40 and (buf[0x34:0x3B] in [FSMAGIC2, FSMAGIC3]) :
     2.9              return True
    2.10          return False