aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2015-10-19 21:38:43 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-21 22:56:06 +0100
commitcf311a770e50ea73cefa2a2c53616500411aa4ac (patch)
tree030f44617037759ef787ad814f6b5459957832b3 /meta/lib/oeqa/utils
parent900639c1b29cfca777ba78da1c413eb71c392978 (diff)
downloadopenembedded-core-contrib-cf311a770e50ea73cefa2a2c53616500411aa4ac.tar.gz
oeqa/utils/ftools: From functions that expect data, check if None
ftools functions that expect data may get 'None'; this patch does this check and return immediately if this is the case. (From OE-Core rev: 5eaa4fa30e2362e6dd572b8a6f7a909b608e14bf) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r--meta/lib/oeqa/utils/ftools.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/ftools.py b/meta/lib/oeqa/utils/ftools.py
index 1ec8a0948f..1bd9a30a40 100644
--- a/meta/lib/oeqa/utils/ftools.py
+++ b/meta/lib/oeqa/utils/ftools.py
@@ -3,11 +3,17 @@ import re
import errno
def write_file(path, data):
+ # In case data is None, return immediately
+ if data is None:
+ return
wdata = data.rstrip() + "\n"
with open(path, "w") as f:
f.write(wdata)
def append_file(path, data):
+ # In case data is None, return immediately
+ if data is None:
+ return
wdata = data.rstrip() + "\n"
with open(path, "a") as f:
f.write(wdata)
@@ -19,6 +25,9 @@ def read_file(path):
return data
def remove_from_file(path, data):
+ # In case data is None, return immediately
+ if data is None:
+ return
try:
rdata = read_file(path)
except IOError as e: