vmspawn: return negative errno from qemu_config_key()/_section_impl()
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user