projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sigprocmask: Avoid crashes through signal() on MSVC 9.
[gnulib.git]
/
lib
/
listen.c
diff --git
a/lib/listen.c
b/lib/listen.c
index
4a77de2
..
b7d070e
100644
(file)
--- a/
lib/listen.c
+++ b/
lib/listen.c
@@
-1,6
+1,6
@@
/* listen.c --- wrappers for Windows listen function
/* listen.c --- wrappers for Windows listen function
- Copyright (C) 2008
, 2009, 2010
Free Software Foundation, Inc.
+ Copyright (C) 2008
-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
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
@@
-32,9
+32,18
@@
int
rpl_listen (int fd, int backlog)
{
SOCKET sock = FD_TO_SOCKET (fd);
rpl_listen (int fd, int backlog)
{
SOCKET sock = FD_TO_SOCKET (fd);
- int r = listen (sock, backlog);
- if (r < 0)
- set_winsock_errno ();
- return r;
+ if (sock == INVALID_SOCKET)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ else
+ {
+ int r = listen (sock, backlog);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+ }
}
}