diff --git a/devices/org.osbuild.loopback b/devices/org.osbuild.loopback index 1b19b924..cc104391 100755 --- a/devices/org.osbuild.loopback +++ b/devices/org.osbuild.loopback @@ -18,11 +18,13 @@ documentation for `osbuil.util.udev.UdevInhibitor`. import argparse +import errno import os import sys from typing import Dict from osbuild import devices, loop +from osbuild.util import ctx from osbuild.util.udev import UdevInhibitor SCHEMA = """ @@ -106,7 +108,8 @@ class LoopbackService(devices.DeviceService): dir_fd = -1 try: dir_fd = os.open(devpath, os.O_CLOEXEC | os.O_PATH) - self.lo.mknod(dir_fd) + with ctx.suppress_oserror(errno.EEXIST): + self.lo.mknod(dir_fd) finally: if dir_fd > -1: os.close(dir_fd)