summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fda0b26)
raw | patch | inline | side by side (parent: fda0b26)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 30 Jun 2014 06:15:14 +0000 (08:15 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Mon, 30 Jun 2014 06:15:14 +0000 (08:15 +0200) |
t/unit/frontend/sock_test.c | patch | blob | history |
index 852a498f3a52e919212753fcc25720f6a0287cb3..09f8ae91cc597341b2d186643f790ef697d9451d 100644 (file)
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "frontend/sock.h"
#include "libsysdb_test.h"
static void
sock_listen(char *tmp_file)
{
- char sock_addr[strlen("unix:") + L_tmpnam + 1];
- char *filename;
-
+ char sock_addr[strlen("unix:") + strlen(tmp_file) + 1];
int check;
- filename = tmpnam(tmp_file);
- fail_unless(filename != NULL,
- "INTERNAL ERROR: tmpnam() = NULL; expected: a string");
-
sprintf(sock_addr, "unix:%s", tmp_file);
check = sdb_fe_sock_add_listener(sock, sock_addr);
fail_unless(check == 0,
"sdb_fe_sock_add_listener(%s) = %i; expected: 0",
sock_addr, check);
-} /* conn */
+} /* sock_listen */
/*
* parallel testing
{
sdb_fe_loop_t loop = SDB_FE_LOOP_INIT;
- char tmp_file[L_tmpnam];
+ char tmp_file[] = "sock_test_socket.XXXXXX";
int check;
pthread_t thr;
"sdb_fe_sock_listen_and_serve() = %i; "
"expected: <0 (before adding listeners)", check);
+ mkstemp(tmp_file);
+ unlink(tmp_file);
sock_listen(tmp_file);
loop.do_loop = 1;