From: Sebastian Harl Date: Fri, 1 Aug 2014 18:35:31 +0000 (+0200) Subject: unit tests: Fixed some -Werror=unused-result compiler errors. X-Git-Tag: sysdb-0.3.0~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2a8cf6a0e542ad86433f58c48b0e1ad134d9503d;p=sysdb.git unit tests: Fixed some -Werror=unused-result compiler errors. --- diff --git a/t/unit/frontend/connection_test.c b/t/unit/frontend/connection_test.c index a38c262..ea93323 100644 --- a/t/unit/frontend/connection_test.c +++ b/t/unit/frontend/connection_test.c @@ -113,8 +113,12 @@ mock_conn_rewind(sdb_conn_t *conn) static void mock_conn_truncate(sdb_conn_t *conn) { + int status; lseek(conn->fd, 0, SEEK_SET); - ftruncate(conn->fd, 0); + status = ftruncate(conn->fd, 0); + fail_unless(status == 0, + "INTERNAL ERROR: ftruncate(%d, 0) = %d; expected: 0", + conn->fd, status); } /* mock_conn_truncate */ static int @@ -207,8 +211,9 @@ START_TEST(test_conn_accept) fail_unless(conn == NULL, "sdb_connection_accept(-1) = %p; expected: NULL", conn); - mkstemp(socket_path); + fd = mkstemp(socket_path); unlink(socket_path); + close(fd); fd = mock_unixsock_listener(socket_path); check = pthread_create(&thr, /* attr = */ NULL, mock_client, socket_path); diff --git a/t/unit/frontend/sock_test.c b/t/unit/frontend/sock_test.c index 09f8ae9..be2c46d 100644 --- a/t/unit/frontend/sock_test.c +++ b/t/unit/frontend/sock_test.c @@ -111,7 +111,7 @@ START_TEST(test_listen_and_serve) pthread_t thr; - int sock_fd; + int fd, sock_fd; struct sockaddr_un sa; check = sdb_fe_sock_listen_and_serve(sock, &loop); @@ -119,8 +119,9 @@ START_TEST(test_listen_and_serve) "sdb_fe_sock_listen_and_serve() = %i; " "expected: <0 (before adding listeners)", check); - mkstemp(tmp_file); + fd = mkstemp(tmp_file); unlink(tmp_file); + close(fd); sock_listen(tmp_file); loop.do_loop = 1;