From: Philippe Mathieu-Daudé Date: Fri, 7 Apr 2017 22:20:15 +0000 (-0300) Subject: qga: fix compiler warnings (clang 5) X-Git-Tag: v2.10.0-rc0~202^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9879f5ac62c1e0c92a5ff2f4a0ada1b66d43da90;p=thirdparty%2Fqemu.git qga: fix compiler warnings (clang 5) static code analyzer complain: qga/commands-posix.c:2127:9: warning: Null pointer passed as an argument to a 'nonnull' parameter closedir(dp); ^~~~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Marc-André Lureau Reviewed-by: Michael Roth Signed-off-by: Michael Tokarev --- diff --git a/qga/commands-posix.c b/qga/commands-posix.c index ba06be4c863..284ecc6d7e4 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -2125,9 +2125,11 @@ static void transfer_memory_block(GuestMemoryBlock *mem_blk, bool sys2memblk, * we think this VM does not support online/offline memory block, * any other solution? */ - if (!dp && errno == ENOENT) { - result->response = - GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED; + if (!dp) { + if (errno == ENOENT) { + result->response = + GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED; + } goto out1; } closedir(dp);