]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
vmspawn: return negative errno from qemu_config_key()/_section_impl()
authorPaul Meyer <katexochen0@gmail.com>
Sat, 13 Jun 2026 08:57:46 +0000 (10:57 +0200)
committerPaul Meyer <katexochen0@gmail.com>
Wed, 17 Jun 2026 08:23:47 +0000 (10:23 +0200)
errno_or_else() already returns a negative errno, so "return
-errno_or_else(EIO)" returned a positive value on fprintf()/ferror()
failure. Callers checking "r < 0" therefore missed the write error and
treated it as success. Drop the spurious negation; these were the only
two "-errno_or_else" uses in the tree.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
src/vmspawn/vmspawn-qemu-config.c

index d17e841e35f324c6f169ee3c77841bbd98c64b98..a58e1f141bccebf097d215f40f989c3f5f14ea62 100644 (file)
@@ -31,7 +31,7 @@ int qemu_config_key(FILE *f, const char *key, const char *value) {
                 return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "QEMU config value '%s' contains unsafe characters.", value);
 
         if (fprintf(f, "  %s = \"%s\"\n", key, value) < 0)
-                return -errno_or_else(EIO);
+                return errno_or_else(EIO);
 
         return 0;
 }
@@ -88,7 +88,7 @@ int qemu_config_section_impl(FILE *f, const char *type, const char *id, ...) {
         va_end(ap);
 
         if (ferror(f))
-                return -errno_or_else(EIO);
+                return errno_or_else(EIO);
 
         return 0;
 }