diff options
author | Doug Barton <dougb@FreeBSD.org> | 2012-04-04 23:11:25 +0000 |
---|---|---|
committer | Doug Barton <dougb@FreeBSD.org> | 2012-04-04 23:11:25 +0000 |
commit | 42d3eba523963ab015ac451eeea0788b11631c94 (patch) | |
tree | d6eb268f26af23cc29cceb581dd5468a2cfef052 /lib/isc/unix | |
parent | 3939884dc90db099f5601bd7c27d39acf7a8c731 (diff) | |
download | src-42d3eba523963ab015ac451eeea0788b11631c94.tar.gz src-42d3eba523963ab015ac451eeea0788b11631c94.zip |
Notes
Diffstat (limited to 'lib/isc/unix')
37 files changed, 90 insertions, 88 deletions
diff --git a/lib/isc/unix/Makefile.in b/lib/isc/unix/Makefile.in index 2c91756f5f14..9884ca90c78d 100644 --- a/lib/isc/unix/Makefile.in +++ b/lib/isc/unix/Makefile.in @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.44 2009-12-05 23:31:41 each Exp $ +# $Id: Makefile.in,v 1.44 2009/12/05 23:31:41 each Exp $ srcdir = @srcdir@ VPATH = @srcdir@ diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index 4dc513008253..5393be942504 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: app.c,v 1.64 2009-11-04 05:58:46 marka Exp $ */ +/* $Id: app.c,v 1.64 2009/11/04 05:58:46 marka Exp $ */ /*! \file */ diff --git a/lib/isc/unix/dir.c b/lib/isc/unix/dir.c index e670f03e50c6..0d647782a1d9 100644 --- a/lib/isc/unix/dir.c +++ b/lib/isc/unix/dir.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007-2009, 2011 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007-2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dir.c,v 1.29.404.2 2011-03-12 04:59:19 tbox Exp $ */ +/* $Id$ */ /*! \file * \author Principal Authors: DCL */ diff --git a/lib/isc/unix/entropy.c b/lib/isc/unix/entropy.c index 9044632842a6..ab53faf6754e 100644 --- a/lib/isc/unix/entropy.c +++ b/lib/isc/unix/entropy.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: entropy.c,v 1.82 2008-12-01 23:47:45 tbox Exp $ */ +/* $Id: entropy.c,v 1.82 2008/12/01 23:47:45 tbox Exp $ */ /* \file unix/entropy.c * \brief diff --git a/lib/isc/unix/errno2result.c b/lib/isc/unix/errno2result.c index 4252de6eab04..f20aa295ca9c 100644 --- a/lib/isc/unix/errno2result.c +++ b/lib/isc/unix/errno2result.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: errno2result.c,v 1.17 2007-06-19 23:47:18 tbox Exp $ */ +/* $Id$ */ /*! \file */ @@ -34,7 +34,7 @@ * not already there. */ isc_result_t -isc__errno2result(int posixerrno) { +isc___errno2result(int posixerrno, const char *file, unsigned int line) { char strbuf[ISC_STRERRORSIZE]; switch (posixerrno) { @@ -55,7 +55,7 @@ isc__errno2result(int posixerrno) { return (ISC_R_IOERROR); case ENOMEM: return (ISC_R_NOMEMORY); - case ENFILE: + case ENFILE: case EMFILE: return (ISC_R_TOOMANYOPENFILES); case EPIPE: @@ -108,8 +108,7 @@ isc__errno2result(int posixerrno) { return (ISC_R_CONNREFUSED); default: isc__strerror(posixerrno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "unable to convert errno " + UNEXPECTED_ERROR(file, line, "unable to convert errno " "to isc_result: %d: %s", posixerrno, strbuf); /* diff --git a/lib/isc/unix/errno2result.h b/lib/isc/unix/errno2result.h index 8770a0562db1..1e49ed1d6c89 100644 --- a/lib/isc/unix/errno2result.h +++ b/lib/isc/unix/errno2result.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: errno2result.h,v 1.12 2007-06-19 23:47:18 tbox Exp $ */ +/* $Id$ */ #ifndef UNIX_ERRNO2RESULT_H #define UNIX_ERRNO2RESULT_H 1 @@ -31,8 +31,10 @@ ISC_LANG_BEGINDECLS +#define isc__errno2result(x) isc___errno2result(x, __FILE__, __LINE__) + isc_result_t -isc__errno2result(int posixerrno); +isc___errno2result(int posixerrno, const char *file, unsigned int line); ISC_LANG_ENDDECLS diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index 3e4d3e01f4d5..0538761a2af7 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009, 2011 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -48,7 +48,7 @@ * SUCH DAMAGE. */ -/* $Id: file.c,v 1.57.10.1 2011-03-04 14:10:13 smann Exp $ */ +/* $Id$ */ /*! \file */ diff --git a/lib/isc/unix/fsaccess.c b/lib/isc/unix/fsaccess.c index c9748195b1af..a2bd89ad7131 100644 --- a/lib/isc/unix/fsaccess.c +++ b/lib/isc/unix/fsaccess.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: fsaccess.c,v 1.13 2007-06-19 23:47:18 tbox Exp $ */ +/* $Id: fsaccess.c,v 1.13 2007/06/19 23:47:18 tbox Exp $ */ #include <config.h> diff --git a/lib/isc/unix/ifiter_getifaddrs.c b/lib/isc/unix/ifiter_getifaddrs.c index 90a3faf84818..637450aaf4f5 100644 --- a/lib/isc/unix/ifiter_getifaddrs.c +++ b/lib/isc/unix/ifiter_getifaddrs.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ifiter_getifaddrs.c,v 1.13 2009-09-24 23:48:13 tbox Exp $ */ +/* $Id: ifiter_getifaddrs.c,v 1.13 2009/09/24 23:48:13 tbox Exp $ */ /*! \file * \brief diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c index 010b3658188e..38c34fd61ab1 100644 --- a/lib/isc/unix/ifiter_ioctl.c +++ b/lib/isc/unix/ifiter_ioctl.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ifiter_ioctl.c,v 1.62 2009-01-18 23:48:14 tbox Exp $ */ +/* $Id: ifiter_ioctl.c,v 1.62 2009/01/18 23:48:14 tbox Exp $ */ /*! \file * \brief diff --git a/lib/isc/unix/ifiter_sysctl.c b/lib/isc/unix/ifiter_sysctl.c index bb30b6a05a8c..9d5bf6d9e7c0 100644 --- a/lib/isc/unix/ifiter_sysctl.c +++ b/lib/isc/unix/ifiter_sysctl.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ifiter_sysctl.c,v 1.25 2007-06-19 23:47:18 tbox Exp $ */ +/* $Id: ifiter_sysctl.c,v 1.25 2007/06/19 23:47:18 tbox Exp $ */ /*! \file * \brief diff --git a/lib/isc/unix/include/Makefile.in b/lib/isc/unix/include/Makefile.in index 8c03aefd320a..0303ab1302b9 100644 --- a/lib/isc/unix/include/Makefile.in +++ b/lib/isc/unix/include/Makefile.in @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.14 2007-06-19 23:47:18 tbox Exp $ +# $Id: Makefile.in,v 1.14 2007/06/19 23:47:18 tbox Exp $ srcdir = @srcdir@ VPATH = @srcdir@ diff --git a/lib/isc/unix/include/isc/Makefile.in b/lib/isc/unix/include/isc/Makefile.in index 5481b3b18199..2f4d2164b2d6 100644 --- a/lib/isc/unix/include/isc/Makefile.in +++ b/lib/isc/unix/include/isc/Makefile.in @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.30 2007-06-19 23:47:19 tbox Exp $ +# $Id: Makefile.in,v 1.30 2007/06/19 23:47:19 tbox Exp $ srcdir = @srcdir@ VPATH = @srcdir@ diff --git a/lib/isc/unix/include/isc/dir.h b/lib/isc/unix/include/isc/dir.h index a6e444050407..e4a2ad0fb70d 100644 --- a/lib/isc/unix/include/isc/dir.h +++ b/lib/isc/unix/include/isc/dir.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dir.h,v 1.21 2007-06-19 23:47:19 tbox Exp $ */ +/* $Id: dir.h,v 1.21 2007/06/19 23:47:19 tbox Exp $ */ /* Principal Authors: DCL */ diff --git a/lib/isc/unix/include/isc/int.h b/lib/isc/unix/include/isc/int.h index 177e68a9e671..73feb3b65b3a 100644 --- a/lib/isc/unix/include/isc/int.h +++ b/lib/isc/unix/include/isc/int.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: int.h,v 1.16 2007-06-19 23:47:19 tbox Exp $ */ +/* $Id: int.h,v 1.16 2007/06/19 23:47:19 tbox Exp $ */ #ifndef ISC_INT_H #define ISC_INT_H 1 diff --git a/lib/isc/unix/include/isc/keyboard.h b/lib/isc/unix/include/isc/keyboard.h index 0f15b1a8489c..43f5e7eec27b 100644 --- a/lib/isc/unix/include/isc/keyboard.h +++ b/lib/isc/unix/include/isc/keyboard.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: keyboard.h,v 1.11 2007-06-19 23:47:19 tbox Exp $ */ +/* $Id: keyboard.h,v 1.11 2007/06/19 23:47:19 tbox Exp $ */ #ifndef ISC_KEYBOARD_H #define ISC_KEYBOARD_H 1 diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index 112f1d7dc1be..efa67c223bef 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.h,v 1.50 2008-12-01 04:14:54 marka Exp $ */ +/* $Id$ */ #ifndef ISC_NET_H #define ISC_NET_H 1 diff --git a/lib/isc/unix/include/isc/netdb.h b/lib/isc/unix/include/isc/netdb.h index d6703f1d4789..ff12a26e22ae 100644 --- a/lib/isc/unix/include/isc/netdb.h +++ b/lib/isc/unix/include/isc/netdb.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: netdb.h,v 1.11 2007-06-19 23:47:19 tbox Exp $ */ +/* $Id: netdb.h,v 1.11 2007/06/19 23:47:19 tbox Exp $ */ #ifndef ISC_NETDB_H #define ISC_NETDB_H 1 diff --git a/lib/isc/unix/include/isc/offset.h b/lib/isc/unix/include/isc/offset.h index 2920899faf90..8bf3779997cd 100644 --- a/lib/isc/unix/include/isc/offset.h +++ b/lib/isc/unix/include/isc/offset.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: offset.h,v 1.17 2008-12-01 23:47:45 tbox Exp $ */ +/* $Id: offset.h,v 1.17 2008/12/01 23:47:45 tbox Exp $ */ #ifndef ISC_OFFSET_H #define ISC_OFFSET_H 1 diff --git a/lib/isc/unix/include/isc/stat.h b/lib/isc/unix/include/isc/stat.h index 4489002f1eda..b7a798649225 100644 --- a/lib/isc/unix/include/isc/stat.h +++ b/lib/isc/unix/include/isc/stat.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stat.h,v 1.5 2007-06-19 23:47:19 tbox Exp $ */ +/* $Id: stat.h,v 1.5 2007/06/19 23:47:19 tbox Exp $ */ #ifndef ISC_STAT_H #define ISC_STAT_H 1 diff --git a/lib/isc/unix/include/isc/stdtime.h b/lib/isc/unix/include/isc/stdtime.h index cadb3820ef0f..c4931bfe6362 100644 --- a/lib/isc/unix/include/isc/stdtime.h +++ b/lib/isc/unix/include/isc/stdtime.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2011 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdtime.h,v 1.14.814.2 2011-03-18 23:47:15 tbox Exp $ */ +/* $Id$ */ #ifndef ISC_STDTIME_H #define ISC_STDTIME_H 1 diff --git a/lib/isc/unix/include/isc/strerror.h b/lib/isc/unix/include/isc/strerror.h index ac8d496871fc..899043bbffdd 100644 --- a/lib/isc/unix/include/isc/strerror.h +++ b/lib/isc/unix/include/isc/strerror.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: strerror.h,v 1.10 2008-12-01 23:47:45 tbox Exp $ */ +/* $Id: strerror.h,v 1.10 2008/12/01 23:47:45 tbox Exp $ */ #ifndef ISC_STRERROR_H #define ISC_STRERROR_H diff --git a/lib/isc/unix/include/isc/syslog.h b/lib/isc/unix/include/isc/syslog.h index 7ac714b91b09..7e0c88cb3b50 100644 --- a/lib/isc/unix/include/isc/syslog.h +++ b/lib/isc/unix/include/isc/syslog.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: syslog.h,v 1.7 2007-06-19 23:47:19 tbox Exp $ */ +/* $Id: syslog.h,v 1.7 2007/06/19 23:47:19 tbox Exp $ */ #ifndef ISC_SYSLOG_H #define ISC_SYSLOG_H 1 diff --git a/lib/isc/unix/include/isc/time.h b/lib/isc/unix/include/isc/time.h index 19f081077e15..dc1cef9ad3f2 100644 --- a/lib/isc/unix/include/isc/time.h +++ b/lib/isc/unix/include/isc/time.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.h,v 1.40 2009-01-05 23:47:54 tbox Exp $ */ +/* $Id: time.h,v 1.40 2009/01/05 23:47:54 tbox Exp $ */ #ifndef ISC_TIME_H #define ISC_TIME_H 1 diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c index 37fc3b1ab528..af2b06d093a6 100644 --- a/lib/isc/unix/interfaceiter.c +++ b/lib/isc/unix/interfaceiter.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: interfaceiter.c,v 1.45 2008-12-01 03:51:47 marka Exp $ */ +/* $Id: interfaceiter.c,v 1.45 2008/12/01 03:51:47 marka Exp $ */ /*! \file */ diff --git a/lib/isc/unix/ipv6.c b/lib/isc/unix/ipv6.c index 3fb14241b3c7..61e984f09d34 100644 --- a/lib/isc/unix/ipv6.c +++ b/lib/isc/unix/ipv6.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ipv6.c,v 1.14 2007-06-19 23:47:18 tbox Exp $ */ +/* $Id: ipv6.c,v 1.14 2007/06/19 23:47:18 tbox Exp $ */ /*! \file */ diff --git a/lib/isc/unix/keyboard.c b/lib/isc/unix/keyboard.c index d022c031ac5e..8ee62d3f5906 100644 --- a/lib/isc/unix/keyboard.c +++ b/lib/isc/unix/keyboard.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: keyboard.c,v 1.13 2007-06-19 23:47:18 tbox Exp $ */ +/* $Id: keyboard.c,v 1.13 2007/06/19 23:47:18 tbox Exp $ */ #include <config.h> diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index 11a06cedf982..ea4a504ebdec 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.c,v 1.40 2008-07-04 05:52:31 each Exp $ */ +/* $Id$ */ #include <config.h> diff --git a/lib/isc/unix/os.c b/lib/isc/unix/os.c index 1a3faf22272e..c050d14c3b6e 100644 --- a/lib/isc/unix/os.c +++ b/lib/isc/unix/os.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: os.c,v 1.18 2007-06-19 23:47:18 tbox Exp $ */ +/* $Id: os.c,v 1.18 2007/06/19 23:47:18 tbox Exp $ */ #include <config.h> diff --git a/lib/isc/unix/resource.c b/lib/isc/unix/resource.c index 99a4b8c5fc94..29596e2aa6a1 100644 --- a/lib/isc/unix/resource.c +++ b/lib/isc/unix/resource.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resource.c,v 1.23 2009-02-13 23:48:14 tbox Exp $ */ +/* $Id: resource.c,v 1.23 2009/02/13 23:48:14 tbox Exp $ */ #include <config.h> diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index c9aa454dd208..9d64a77ab37b 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.333.14.9 2011-07-29 02:19:20 marka Exp $ */ +/* $Id$ */ /*! \file */ @@ -1584,7 +1584,7 @@ allocate_socketevent(isc__socket_t *sock, isc_eventtype_t eventtype, if (ev == NULL) return (NULL); - ev->result = ISC_R_UNEXPECTED; + ev->result = ISC_R_UNSET; ISC_LINK_INIT(ev, ev_link); ISC_LIST_INIT(ev->bufferlist); ev->region.base = NULL; @@ -2037,8 +2037,6 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type, if (sock == NULL) return (ISC_R_NOMEMORY); - result = ISC_R_UNEXPECTED; - sock->common.magic = 0; sock->common.impmagic = 0; sock->references = 0; @@ -2066,8 +2064,10 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type, sock->recvcmsgbuflen = cmsgbuflen; if (sock->recvcmsgbuflen != 0U) { sock->recvcmsgbuf = isc_mem_get(manager->mctx, cmsgbuflen); - if (sock->recvcmsgbuf == NULL) + if (sock->recvcmsgbuf == NULL) { + result = ISC_R_NOMEMORY; goto error; + } } cmsgbuflen = 0; @@ -2084,8 +2084,10 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type, sock->sendcmsgbuflen = cmsgbuflen; if (sock->sendcmsgbuflen != 0U) { sock->sendcmsgbuf = isc_mem_get(manager->mctx, cmsgbuflen); - if (sock->sendcmsgbuf == NULL) + if (sock->sendcmsgbuf == NULL) { + result = ISC_R_NOMEMORY; goto error; + } } memset(sock->name, 0, sizeof(sock->name)); @@ -2223,6 +2225,7 @@ clear_bsdcompat(void) { static isc_result_t opensocket(isc__socketmgr_t *manager, isc__socket_t *sock) { + isc_result_t result; char strbuf[ISC_STRERRORSIZE]; const char *err = "socket"; int tries = 0; @@ -2327,9 +2330,10 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock) { } } - if (make_nonblock(sock->fd) != ISC_R_SUCCESS) { + result = make_nonblock(sock->fd); + if (result != ISC_R_SUCCESS) { (void)close(sock->fd); - return (ISC_R_UNEXPECTED); + return (result); } #ifdef SO_BSDCOMPAT @@ -3191,10 +3195,12 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { UNLOCK(&sock->lock); - if (fd != -1 && (make_nonblock(fd) != ISC_R_SUCCESS)) { - (void)close(fd); - fd = -1; - result = ISC_R_UNEXPECTED; + if (fd != -1) { + result = make_nonblock(fd); + if (result != ISC_R_SUCCESS) { + (void)close(fd); + fd = -1; + } } /* @@ -3729,7 +3735,6 @@ static isc_threadresult_t watcher(void *uap) { isc__socketmgr_t *manager = uap; isc_boolean_t done; - int ctlfd; int cc; #ifdef USE_KQUEUE const char *fnname = "kevent()"; @@ -3741,16 +3746,19 @@ watcher(void *uap) { #elif defined (USE_SELECT) const char *fnname = "select()"; int maxfd; + int ctlfd; #endif char strbuf[ISC_STRERRORSIZE]; #ifdef ISC_SOCKET_USE_POLLWATCH pollstate_t pollstate = poll_idle; #endif +#if defined (USE_SELECT) /* * Get the control fd here. This will never change. */ ctlfd = manager->pipe_fds[0]; +#endif done = ISC_FALSE; while (!done) { do { @@ -4551,7 +4559,7 @@ isc__socket_recv2(isc_socket_t *sock0, isc_region_t *region, isc__socket_t *sock = (isc__socket_t *)sock0; event->ev_sender = sock; - event->result = ISC_R_UNEXPECTED; + event->result = ISC_R_UNSET; ISC_LIST_INIT(event->bufferlist); event->region = *region; event->n = 0; @@ -4765,7 +4773,7 @@ isc__socket_sendto2(isc_socket_t *sock0, isc_region_t *region, if ((flags & ISC_SOCKFLAG_NORETRY) != 0) REQUIRE(sock->type == isc_sockettype_udp); event->ev_sender = sock; - event->result = ISC_R_UNEXPECTED; + event->result = ISC_R_UNSET; ISC_LIST_INIT(event->bufferlist); event->region = *region; event->n = 0; diff --git a/lib/isc/unix/socket_p.h b/lib/isc/unix/socket_p.h index b6c4b6a909af..13160117391f 100644 --- a/lib/isc/unix/socket_p.h +++ b/lib/isc/unix/socket_p.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket_p.h,v 1.15 2009-09-02 23:48:03 tbox Exp $ */ +/* $Id: socket_p.h,v 1.15 2009/09/02 23:48:03 tbox Exp $ */ #ifndef ISC_SOCKET_P_H #define ISC_SOCKET_P_H diff --git a/lib/isc/unix/stdio.c b/lib/isc/unix/stdio.c index 9221d2a0ea7d..360c8c644afc 100644 --- a/lib/isc/unix/stdio.c +++ b/lib/isc/unix/stdio.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2007, 2011 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdio.c,v 1.8.814.2 2011-03-05 23:52:09 tbox Exp $ */ +/* $Id$ */ #include <config.h> @@ -105,12 +105,23 @@ isc_stdio_flush(FILE *f) { return (isc__errno2result(errno)); } +/* + * OpenBSD has deprecated ENOTSUP in favor of EOPNOTSUPP. + */ +#if defined(EOPNOTSUPP) && !defined(ENOTSUP) +#define ENOTSUP EOPNOTSUPP +#endif + isc_result_t isc_stdio_sync(FILE *f) { int r; r = fsync(fileno(f)); - if (r == 0) + /* + * fsync is not supported on sockets and pipes which + * result in EINVAL / ENOTSUP. + */ + if (r == 0 || errno == EINVAL || errno == ENOTSUP) return (ISC_R_SUCCESS); else return (isc__errno2result(errno)); diff --git a/lib/isc/unix/stdtime.c b/lib/isc/unix/stdtime.c index 11b253354303..c5d0c47df1fc 100644 --- a/lib/isc/unix/stdtime.c +++ b/lib/isc/unix/stdtime.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdtime.c,v 1.19 2007-06-19 23:47:18 tbox Exp $ */ +/* $Id: stdtime.c,v 1.19 2007/06/19 23:47:18 tbox Exp $ */ /*! \file */ diff --git a/lib/isc/unix/strerror.c b/lib/isc/unix/strerror.c index 4a61a975ebb5..caa6659154f9 100644 --- a/lib/isc/unix/strerror.c +++ b/lib/isc/unix/strerror.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: strerror.c,v 1.10 2009-02-16 23:48:04 tbox Exp $ */ +/* $Id: strerror.c,v 1.10 2009/02/16 23:48:04 tbox Exp $ */ /*! \file */ diff --git a/lib/isc/unix/syslog.c b/lib/isc/unix/syslog.c index a752abd1b36d..997508e32b44 100644 --- a/lib/isc/unix/syslog.c +++ b/lib/isc/unix/syslog.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: syslog.c,v 1.8 2007-09-13 04:45:18 each Exp $ */ +/* $Id: syslog.c,v 1.8 2007/09/13 04:45:18 each Exp $ */ /*! \file */ diff --git a/lib/isc/unix/time.c b/lib/isc/unix/time.c index 8d1d9fa2ec66..ac23ae092804 100644 --- a/lib/isc/unix/time.c +++ b/lib/isc/unix/time.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008, 2011 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.c,v 1.56.608.2 2011-03-12 04:59:19 tbox Exp $ */ +/* $Id$ */ /*! \file */ @@ -334,7 +334,6 @@ isc_time_seconds(const isc_time_t *t) { isc_result_t isc_time_secondsastimet(const isc_time_t *t, time_t *secondsp) { - isc_uint64_t i; time_t seconds; REQUIRE(t != NULL); @@ -354,33 +353,16 @@ isc_time_secondsastimet(const isc_time_t *t, time_t *secondsp) { * pretty much only true if time_t is a signed integer of the same * size as the return value of isc_time_seconds. * - * The use of the 64 bit integer ``i'' takes advantage of C's - * conversion rules to either zero fill or sign extend the widened - * type. - * - * Solaris 5.6 gives this warning about the left shift: - * warning: integer overflow detected: op "<<" - * if the U(nsigned) qualifier is not on the 1. + * If the paradox in the if clause below is true, t->seconds is out + * of range for time_t. */ seconds = (time_t)t->seconds; INSIST(sizeof(unsigned int) == sizeof(isc_uint32_t)); INSIST(sizeof(time_t) >= sizeof(isc_uint32_t)); - if (sizeof(time_t) == sizeof(isc_uint32_t) && /* Same size. */ - (time_t)0.5 != 0.5 && /* Not a floating point type. */ - (i = (time_t)-1) != 4294967295u && /* Is signed. */ - (seconds & - (1U << (sizeof(time_t) * CHAR_BIT - 1))) != 0U) { /* Negative. */ - /* - * This UNUSED() is here to shut up the IRIX compiler: - * variable "i" was set but never used - * when the value of i *was* used in the third test. - * (Let's hope the compiler got the actual test right.) - */ - UNUSED(i); + if (t->seconds > (~0U>>1) && seconds <= (time_t)(~0U>>1)) return (ISC_R_RANGE); - } *secondsp = seconds; |