selftests: kvm: fix mismatched fclose() after popen()
authorShuah Khan <skhan@linuxfoundation.org>
Thu, 21 Oct 2021 17:56:03 +0000 (11:56 -0600)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 21 Oct 2021 21:16:28 +0000 (15:16 -0600)
commitc3867ab5924b7a9a0b4a117902a08669d8be7c21
tree61a65ab0e536615e7e9ccd05c4cb2db651e888d5
parent519d81956ee277b4419c723adfb154603c2565ba
selftests: kvm: fix mismatched fclose() after popen()

get_warnings_count() does fclose() using File * returned from popen().
Fix it to call pclose() as it should.

tools/testing/selftests/kvm/x86_64/mmio_warning_test
x86_64/mmio_warning_test.c: In function ‘get_warnings_count’:
x86_64/mmio_warning_test.c:87:9: warning: ‘fclose’ called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
   87 |         fclose(f);
      |         ^~~~~~~~~
x86_64/mmio_warning_test.c:84:13: note: returned from ‘popen’
   84 |         f = popen("dmesg | grep \"WARNING:\" | wc -l", "r");
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/kvm/x86_64/mmio_warning_test.c