]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ukify: fail if the config file was not read 28999/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 28 Aug 2023 15:44:42 +0000 (18:44 +0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 29 Aug 2023 12:16:35 +0000 (15:16 +0300)
Inspired by https://github.com/systemd/systemd/pull/28997.
Noticed by Alvin Alvarado <alvin@striczkof.io>.

src/ukify/ukify.py

index 10a464bb1a337ccea4eb2f0b55f717b45972a7ef..b7e21dafed7b5550846178ba66b705ababa58133 100755 (executable)
@@ -1413,7 +1413,10 @@ def apply_config(namespace, filename=None):
     # Do not make keys lowercase
     cp.optionxform = lambda option: option
 
-    cp.read(filename)
+    # The API is not great.
+    read = cp.read(filename)
+    if not read:
+        raise IOError(f'Failed to read {filename}')
 
     for section_name, section in cp.items():
         idx = section_name.find(':')