projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NEWS.stable: log cherry-pick [e446f25]->[c092018] relocatable-shell: Update suggested...
[gnulib.git]
/
lib
/
send.c
diff --git
a/lib/send.c
b/lib/send.c
index
6ab4b01
..
26c7a27
100644
(file)
--- a/
lib/send.c
+++ b/
lib/send.c
@@
-1,6
+1,6
@@
/* send.c --- wrappers for Windows send function
/* send.c --- wrappers for Windows send function
- Copyright (C) 2008-201
0
Free Software Foundation, Inc.
+ Copyright (C) 2008-201
4
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
@@
ssize_t
rpl_send (int fd, const void *buf, size_t len, int flags)
{
SOCKET sock = FD_TO_SOCKET (fd);
rpl_send (int fd, const void *buf, size_t len, int flags)
{
SOCKET sock = FD_TO_SOCKET (fd);
- int r = send (sock, buf, len, flags);
- if (r < 0)
- set_winsock_errno ();
- return r;
+ if (sock == INVALID_SOCKET)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ else
+ {
+ int r = send (sock, buf, len, flags);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+ }
}
}