projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
debian/copyright updates; clscan: fix formatting
[gnulib.git]
/
lib
/
bind.c
diff --git
a/lib/bind.c
b/lib/bind.c
index
108a239
..
aa5d344
100644
(file)
--- a/
lib/bind.c
+++ b/
lib/bind.c
@@
-1,6
+1,6
@@
/* bind.c --- wrappers for Windows bind function
/* bind.c --- wrappers for Windows bind function
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008
-2014
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
@@
-29,12
+29,21
@@
#undef bind
int
#undef bind
int
-rpl_bind (int fd,
struct sockaddr *sockaddr, in
t len)
+rpl_bind (int fd,
const struct sockaddr *sockaddr, socklen_
t len)
{
SOCKET sock = FD_TO_SOCKET (fd);
{
SOCKET sock = FD_TO_SOCKET (fd);
- int r = bind (sock, sockaddr, len);
- if (r < 0)
- set_winsock_errno ();
- return r;
+ if (sock == INVALID_SOCKET)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ else
+ {
+ int r = bind (sock, sockaddr, len);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+ }
}
}