X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fsh%2Fnetconn.c;h=36e5bf5c75188b06c1c1d5a0b6913f48369d132f;hb=3185942a5234e26ab13fa02f9c51d340cec514f8;hp=d05aef559fbf28792bb7d173637ad4b949983e51;hpb=b80f6443b6b7b620c7272664c66ecb0b120a0998;p=platform%2Fupstream%2Fbash.git diff --git a/lib/sh/netconn.c b/lib/sh/netconn.c index d05aef5..36e5bf5 100644 --- a/lib/sh/netconn.c +++ b/lib/sh/netconn.c @@ -1,22 +1,21 @@ /* netconn.c -- is a particular file descriptor a network connection?. */ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002-2005 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. - Bash is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + Bash is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - Bash is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. + Bash is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with Bash; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + along with Bash. If not, see . */ #include @@ -52,8 +51,8 @@ isnetconn (fd) l = sizeof(sa); rv = getpeername(fd, &sa, &l); - /* Solaris 2.5 getpeername() returns EINVAL if the fd is not a socket. */ - return ((rv < 0 && (errno == ENOTSOCK || errno == EINVAL)) ? 0 : 1); + /* Posix.2 says getpeername can return these errors. */ + return ((rv < 0 && (errno == ENOTSOCK || errno == ENOTCONN || errno == EINVAL)) ? 0 : 1); #else /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */ # if defined (SVR4) || defined (SVR4_2) /* Sockets on SVR4 and SVR4.2 are character special (streams) devices. */