aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorKunwu <chentao@kylinos.cn>2024-10-10 10:34:55 +0800
committerDaniel P. Berrangé <berrange@redhat.com>2024-10-10 13:41:45 +0100
commit08e702043fbee7b366d1d27c1b6682090c46c0d6 (patch)
treead55af82212ead904db40e577951ef460d9d4f1b /tests/unit
parent95cc223afbde013c2dd0d6399211227861dbd9b2 (diff)
tests/unit: Add a assert for test_io_channel_unix_listen_cleanup
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>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test-io-channel-socket.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/unit/test-io-channel-socket.c b/tests/unit/test-io-channel-socket.c
index b964bb202d..dc7be96e9c 100644
--- 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,