[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[Fedora-livecd-list] [PATCH] bugfix- losetup truncation problem
- From: Douglas McClendon <dmc fedora filteredperception org>
- To: fedora-livecd-list redhat com
- Subject: [Fedora-livecd-list] [PATCH] bugfix- losetup truncation problem
- Date: Sun, 16 Sep 2007 22:56:55 -0500
attached patch fixes the losetup truncation problem brought up by Chris
Hubick.
-dmc
diff -Naur livecd.200709140049/creator/livecd-creator livecd/creator/livecd-creator
--- livecd.200709140049/creator/livecd-creator 2007-09-14 05:49:42.000000000 +0000
+++ livecd/creator/livecd-creator 2007-09-17 03:36:43.000000000 +0000
@@ -109,24 +109,18 @@
if self.losetup:
return
- rc = subprocess.call(["/sbin/losetup", "-f", self.lofile])
- if rc != 0:
- raise MountError("Failed to allocate loop device for '%s'" % self.lofile)
+ losetupProc = subprocess.Popen(["/sbin/losetup", "-f"],
+ stdout=subprocess.PIPE)
+ losetupOutput = losetupProc.communicate()[0]
- # succeeded; figure out which loopdevice we're using
- buf = subprocess.Popen(["/sbin/losetup", "-a"],
- stdout=subprocess.PIPE).communicate()[0]
- for line in buf.split("\n"):
- # loopdev: fdinfo (filename)
- fields = line.split()
- if len(fields) != 3:
- continue
- if fields[2] == "(%s)" %(self.lofile,):
- self.loopdev = fields[0][:-1]
- break
+ if losetupProc.returncode:
+ raise MountError("Failed to allocate loop device for '%s'" % self.lofile)
+ else:
+ self.loopdev = losetupOutput.split()[0]
- if not self.loopdev:
- raise MountError("Failed to find loop device associated with '%s' from '/sbin/losetup -a'" % self.lofile)
+ rc = subprocess.call(["/sbin/losetup", self.loopdev, self.lofile])
+ if rc != 0:
+ raise MountError("Failed to allocate loop device for '%s'" % self.lofile)
self.losetup = True
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]