diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-10-22 11:07:29 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-10-22 11:07:29 +0200 |
commit | 3249f6264a937cd7604d17bf13e284dcd5c5f180 (patch) | |
tree | 68f7b2268a3b9369f7b91ac20b30b8edaab797d8 /gl/tests/test-listen.c | |
parent | d35d3ba149b2424aed91d8398a364532c983fe71 (diff) | |
download | gnutls-3249f6264a937cd7604d17bf13e284dcd5c5f180.tar.gz |
added new gnulib and modules.
Diffstat (limited to 'gl/tests/test-listen.c')
-rw-r--r-- | gl/tests/test-listen.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gl/tests/test-listen.c b/gl/tests/test-listen.c new file mode 100644 index 0000000000..becc453307 --- /dev/null +++ b/gl/tests/test-listen.c @@ -0,0 +1,47 @@ +/* Test listen() function. + Copyright (C) 2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +#include <sys/socket.h> + +#include "signature.h" +SIGNATURE_CHECK (listen, int, (int, int)); + +#include <errno.h> + +#include "sockets.h" +#include "macros.h" + +int +main (void) +{ + gl_sockets_startup (SOCKETS_1_1); + + /* Test behaviour for invalid file descriptors. */ + { + errno = 0; + ASSERT (listen (-1, 1) == -1); + ASSERT (errno == EBADF); + } + { + errno = 0; + ASSERT (listen (99 ,1) == -1); + ASSERT (errno == EBADF); + } + + return 0; +} |