projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
95cc223
)
tests/unit: Add a assert for test_io_channel_unix_listen_cleanup
author
Kunwu
<chentao@kylinos.cn>
Thu, 10 Oct 2024 02:34:55 +0000
(10:34 +0800)
committer
Daniel P. Berrangé
<berrange@redhat.com>
Thu, 10 Oct 2024 12:41:45 +0000
(13:41 +0100)
Calling bind without checking return value. Add a assert for it.
Signed-off-by: Kunwu <chentao@kylinos.cn>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/unit/test-io-channel-socket.c
patch
|
blob
|
history
diff --git
a/tests/unit/test-io-channel-socket.c
b/tests/unit/test-io-channel-socket.c
index b964bb202db10e76971a466a1fb898feae91143d..dc7be96e9cd8059e13f8eb1f56bd6dbed988ffe3 100644
(file)
--- a/
tests/unit/test-io-channel-socket.c
+++ b/
tests/unit/test-io-channel-socket.c
@@
-506,7
+506,7
@@
static void test_io_channel_unix_listen_cleanup(void)
{
QIOChannelSocket *ioc;
struct sockaddr_un un;
- int sock;
+ int sock
, ret = 0
;
#define TEST_SOCKET "test-io-channel-socket.sock"
@@
-519,7
+519,9
@@
static void test_io_channel_unix_listen_cleanup(void)
un.sun_family = AF_UNIX;
snprintf(un.sun_path, sizeof(un.sun_path), "%s", TEST_SOCKET);
unlink(TEST_SOCKET);
- bind(sock, (struct sockaddr *)&un, sizeof(un));
+ ret = bind(sock, (struct sockaddr *)&un, sizeof(un));
+ g_assert_cmpint(ret, ==, 0);
+
ioc->fd = sock;
ioc->localAddrLen = sizeof(ioc->localAddr);
getsockname(sock, (struct sockaddr *)&ioc->localAddr,