summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/imager/direct.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-11-02 22:33:07 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-06 23:35:23 +0000
commit1ba6101ceaee354816e690d44bc9a5dd8dcf4011 (patch)
tree26c90bbabd1172997cc153d8f984f5ab033748fd /scripts/lib/wic/imager/direct.py
parentd2b7b3fca328449cd87997be7f897b59433a153d (diff)
downloadopenembedded-core-1ba6101ceaee354816e690d44bc9a5dd8dcf4011.tar.gz
wic: call os.ftruncate instead of running truncate
Replaced running of truncate utility with the standard library call os.ftruncate Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/lib/wic/imager/direct.py')
-rw-r--r--scripts/lib/wic/imager/direct.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index edf5e5d221..2bedef08d6 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -56,8 +56,9 @@ class DiskImage():
if self.created:
return
# create sparse disk image
- cmd = "truncate %s -s %s" % (self.device, self.size)
- exec_cmd(cmd)
+ with open(self.device, 'w') as sparse:
+ os.ftruncate(sparse.fileno(), self.size)
+
self.created = True
class DirectImageCreator(BaseImageCreator):