kern/84761: shutdown() of non-connected socket should fail with
maxim at macomnet.ru
Wed Aug 10 18:00:34 GMT 2005
The following reply was made to PR kern/84761; it has been noted by GNATS.
From: Maxim Konovalov <maxim at macomnet.ru>
To: James Juran <James.Juran at baesystems.com>
Cc: bug-followup at freebsd.org, rwarson at freebsd.org
Subject: Re: kern/84761: shutdown() of non-connected socket should fail with
Date: Wed, 10 Aug 2005 21:57:44 +0400 (MSD)
> Calling shutdown(2) on a non-connected socket should fail with ENOTCONN
> according to the manpage. Instead, it succeeds.
Indeed, Linux 2.4 and Solaris 9 return ENOTCONN. It seems all BSDs
> Run this program. It should hit the perror(), but instead prints
> "shutdown succeeded".
Here is a patch but I'm not sure about it and CC'ed rwatson at . Robert,
what do you think?
RCS file: /home/ncvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.242
diff -u -p -r1.242 uipc_socket.c
--- uipc_socket.c 1 Jul 2005 16:28:30 -0000 1.242
+++ uipc_socket.c 10 Aug 2005 17:20:39 -0000
@@ -1428,7 +1428,8 @@ soshutdown(so, how)
if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR))
+ if ((so->so_state & SS_ISCONNECTED) == 0)
+ return (ENOTCONN);
if (how != SHUT_WR)
if (how != SHUT_RD)
More information about the freebsd-bugs