From f15802a9aaf453d38f3e7a999a43c2c98fe86810 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 18 Apr 2022 09:15:09 -0400 Subject: [PATCH] Fix capture of non-selinux systems --- imgutil/imgutil | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imgutil/imgutil b/imgutil/imgutil index 7bf24065..500d0d18 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -97,7 +97,10 @@ class FileMasker(): filename = filename[1:] filename = os.path.join('/run/imgutil/capin/', filename) for tfilename in glob.glob(filename): - secontext = os.getxattr(tfilename, 'security.selinux') + try: + secontext = os.getxattr(tfilename, 'security.selinux') + except OSError: + secontext = None if maskwith is None: tmaskwith = tempfile.mkstemp() os.close(tmaskwith[0])