summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4c23b78)
raw | patch | inline | side by side (parent: 4c23b78)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 1 Aug 2014 18:35:31 +0000 (20:35 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 1 Aug 2014 18:35:31 +0000 (20:35 +0200) |
t/unit/frontend/connection_test.c | patch | blob | history | |
t/unit/frontend/sock_test.c | patch | blob | history |
index a38c262c3febeba6715b884245d343e15acb92c3..ea933233d2f8bf9e21611a761b0ecc4a7f20e35f 100644 (file)
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
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);
index 09f8ae91cc597341b2d186643f790ef697d9451d..be2c46d5536a7b455275883685327852eedbc348 100644 (file)
pthread_t thr;
- int sock_fd;
+ int fd, sock_fd;
struct sockaddr_un sa;
check = sdb_fe_sock_listen_and_serve(sock, &loop);
"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;