projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
maint: update copyright
[gnulib.git]
/
lib
/
recv.c
diff --git
a/lib/recv.c
b/lib/recv.c
index
73e2a11
..
1996498
100644
(file)
--- a/
lib/recv.c
+++ b/
lib/recv.c
@@
-1,6
+1,6
@@
/* recv.c --- wrappers for Windows recv function
/* recv.c --- wrappers for Windows recv function
- Copyright (C) 2008
, 2009, 2010
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
@@
-28,13
+28,22
@@
#undef recv
#undef recv
-
in
t
-rpl_recv (int fd, void *buf,
in
t len, int flags)
+
ssize_
t
+rpl_recv (int fd, void *buf,
size_
t len, int flags)
{
SOCKET sock = FD_TO_SOCKET (fd);
{
SOCKET sock = FD_TO_SOCKET (fd);
- int r = recv (sock, buf, len, flags);
- if (r < 0)
- set_winsock_errno ();
- return r;
+ if (sock == INVALID_SOCKET)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ else
+ {
+ int r = recv (sock, buf, len, flags);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+ }
}
}