freebsd-dev/lib/libc
Ed Schouten b114aa7959 Make shutdown() return ENOTCONN as required by POSIX, part deux.
Summary:
Back in 2005, maxim@ attempted to fix shutdown() to return ENOTCONN in case the socket was not connected (r150152). This had to be rolled back (r150155), as it broke some of the existing programs that depend on this behavior. I reapplied this change on my system and indeed, syslogd failed to start up. I fixed this back in February (279016) and MFC'ed it to the supported stable branches. Apart from that, things seem to work out all right.

Since at least Linux and Mac OS X do the right thing, I'd like to go ahead and give this another try. To keep old copies of syslogd working, only start returning ENOTCONN for recent binaries.

I took a look at the XNU sources and they seem to test against both SS_ISCONNECTED, SS_ISCONNECTING and SS_ISDISCONNECTING, instead of just SS_ISCONNECTED. That seams reasonable, so let's do the same.

Test Plan:
This issue was uncovered while writing tests for shutdown() in CloudABI:

https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/sys/socket/shutdown_test.c#L26

Reviewers: glebius, rwatson, #manpages, gnn, #network

Reviewed By: gnn, #network

Subscribers: bms, mjg, imp

Differential Revision: https://reviews.freebsd.org/D3039
2015-07-27 13:17:57 +00:00
..
aarch64 Add support for makecontext. This supports up to 8 arguments as this 2015-07-10 08:36:22 +00:00
amd64 Remove reboot.S (part of libc). It's not needed and was actually 2015-07-07 09:25:51 +00:00
arm Export the ARM __aeabi_mem* functions from libc, they are needed by the gcc 2015-06-16 16:40:25 +00:00
capability use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
compat-43 Reduce the size of the interposing table and amount of 2015-01-11 22:16:31 +00:00
db Drop some unnecessary casts. 2015-05-18 16:28:13 +00:00
gdtoa Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP} 2014-03-04 02:19:39 +00:00
gen Add missing priority argument in example code in BUGS section. 2015-07-21 09:44:45 +00:00
gmon Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP} 2014-03-04 02:19:39 +00:00
i386 Remove reboot.S (part of libc). It's not needed and was actually 2015-07-07 09:25:51 +00:00
iconv Fix improbable memory leak in _citrus_prop_read_str(). 2015-04-20 22:09:50 +00:00
include Reassign copyright statements on several files from Advanced 2015-04-23 14:22:20 +00:00
inet Update our stub resolver to final version of libbind. 2014-08-12 12:36:06 +00:00
isc Update our stub resolver to final version of libbind. 2014-08-12 12:36:06 +00:00
locale __xlocale_C_ctype should not be const. It contains a reference count that is modified by newlocale / duplocale / freelocale. 2015-04-24 10:21:20 +00:00
md Bring the md5 functions into libc for internal use only. 2014-08-12 12:25:56 +00:00
mips Removed unused special fork() implementations. 2015-05-29 19:42:55 +00:00
nameser Add missing break. 2014-08-20 14:58:25 +00:00
net Fix name of a constant. 2015-06-14 20:16:36 +00:00
nls Use mdoc(7) macros to handle parenthesis 2015-04-26 10:54:52 +00:00
posix1e Update Capsicum and Mandatory Access Control manual pages 2015-07-25 15:56:49 +00:00
powerpc The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), and 2015-04-18 21:50:13 +00:00
powerpc64 The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), and 2015-04-18 21:50:13 +00:00
quad Remove MK_ARM_EABI, the armeb issues have been fixed. The code to support 2014-10-01 08:26:51 +00:00
regex mdoc: rendering fixes 2015-04-26 10:55:39 +00:00
resolv Add support for '_' occurring at the beginning or end of a name 2015-06-10 16:15:22 +00:00
rpc mdoc: fix functions declarations 2015-04-26 10:53:50 +00:00
softfloat Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP} 2014-03-04 02:19:39 +00:00
sparc64 The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), and 2015-04-18 21:50:13 +00:00
stdio Add fdclose(3) function. 2015-07-04 16:42:14 +00:00
stdlib Document the fact that system(3) can easily be misused due to shell meta 2015-07-25 00:21:29 +00:00
stdtime 1) Fix the case we have less arguments for format string than we expected. 2014-10-07 06:34:05 +00:00
string strchr(3): Mdoc fixes. 2015-06-04 21:54:46 +00:00
sys Make shutdown() return ENOTCONN as required by POSIX, part deux. 2015-07-27 13:17:57 +00:00
tests Add support for makecontext. This supports up to 8 arguments as this 2015-07-10 08:36:22 +00:00
uuid Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP} 2014-03-04 02:19:39 +00:00
xdr Use proper prototype for harmless(). 2015-05-31 19:09:24 +00:00
yp Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP} 2014-03-04 02:19:39 +00:00
libc.ldscript Attempt to move the POSIX iconv* symbols out of runtime linker space. 2013-11-17 22:52:17 +00:00
Makefile Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
Makefile.depend new depends 2015-06-16 23:37:19 +00:00
Versions.def Fix the inheritance of the FBSDprivate_1.0 namespace. 2014-04-03 17:31:38 +00:00