From 019e78ba6ec6f402dffc6bc9683f461a11a52c28 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 17 May 2010 10:36:47 +0200 Subject: Fix error handling in qemu_read_config_file We need to close the file even in error case. While at it, make the callers catch all kind of errors. ENOENT is allowed for default config files, they are optional. Reported-by: Luiz Capitulino Signed-off-by: Kevin Wolf Signed-off-by: Anthony Liguori --- vl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 8c818f0d24..328395e3dd 100644 --- a/vl.c +++ b/vl.c @@ -2662,12 +2662,12 @@ int main(int argc, char **argv, char **envp) int ret; ret = qemu_read_config_file(CONFIG_QEMU_CONFDIR "/qemu.conf"); - if (ret == -EINVAL) { + if (ret < 0 && ret != -ENOENT) { exit(1); } ret = qemu_read_config_file(arch_config_name); - if (ret == -EINVAL) { + if (ret < 0 && ret != -ENOENT) { exit(1); } } -- cgit v1.2.3