PERFORCE change 130898 for review
John Birrell
jb at FreeBSD.org
Fri Dec 14 14:25:05 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=130898
Change 130898 by jb at jb_freebsd1 on 2007/12/14 22:24:24
IF7
Affected files ...
.. //depot/projects/dtrace7/src/lib/libc/nameser/ns_parse.c#2 integrate
.. //depot/projects/dtrace7/src/lib/libc/resolv/res_data.c#2 integrate
.. //depot/projects/dtrace7/src/lib/libc/resolv/res_init.c#2 integrate
.. //depot/projects/dtrace7/src/sys/kern/init_main.c#4 edit
.. //depot/projects/dtrace7/src/sys/kern/kern_proc.c#4 integrate
.. //depot/projects/dtrace7/src/sys/kern/kern_thread.c#3 integrate
.. //depot/projects/dtrace7/src/sys/sys/eventhandler.h#3 integrate
Differences ...
==== //depot/projects/dtrace7/src/lib/libc/nameser/ns_parse.c#2 (text+ko) ====
@@ -16,8 +16,10 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_parse.c,v 1.5.18.3 2005/10/11 00:25:10 marka Exp $";
+static const char rcsid[] = "$Id: ns_parse.c,v 1.5.18.4 2007/08/27 03:34:24 marka Exp $";
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/nameser/ns_parse.c,v 1.1.1.2.2.1 2007/12/14 20:32:13 ume Exp $");
/* Import. */
@@ -40,7 +42,7 @@
/* Macros. */
-#ifndef SOLARIS2
+#if !defined(SOLARIS2) || defined(__COVERITY__)
#define RETERR(err) do { errno = (err); return (-1); } while (0)
#else
#define RETERR(err) \
==== //depot/projects/dtrace7/src/lib/libc/resolv/res_data.c#2 (text+ko) ====
@@ -16,10 +16,10 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: res_data.c,v 1.3.18.1 2005/04/27 05:01:10 sra Exp $";
+static const char rcsid[] = "$Id: res_data.c,v 1.3.18.2 2007/09/14 05:35:47 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/resolv/res_data.c,v 1.4 2007/06/03 17:20:27 ume Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/resolv/res_data.c,v 1.4.2.1 2007/12/14 20:32:13 ume Exp $");
#include "port_before.h"
==== //depot/projects/dtrace7/src/lib/libc/resolv/res_init.c#2 (text+ko) ====
@@ -66,10 +66,10 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$Id: res_init.c,v 1.16.18.5 2006/08/30 23:23:13 marka Exp $";
+static const char rcsid[] = "$Id: res_init.c,v 1.16.18.7 2007/07/09 01:52:58 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/resolv/res_init.c,v 1.6 2007/06/03 17:20:27 ume Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/resolv/res_init.c,v 1.6.2.1 2007/12/14 20:32:13 ume Exp $");
#include "port_before.h"
@@ -168,7 +168,9 @@
#endif
int dots;
union res_sockaddr_union u[2];
+ int maxns = MAXNS;
+ RES_SET_H_ERRNO(statp, 0);
if (statp->_u._ext.ext != NULL)
res_ndestroy(statp);
@@ -218,8 +220,22 @@
statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa");
strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int");
- } else
- return (-1);
+ } else {
+ /*
+ * Historically res_init() rarely, if at all, failed.
+ * Examples and applications exist which do not check
+ * our return code. Furthermore several applications
+ * simply call us to get the systems domainname. So
+ * rather then immediately fail here we store the
+ * failure, which is returned later, in h_errno. And
+ * prevent the collection of 'nameserver' information
+ * by setting maxns to 0. Thus applications that fail
+ * to check our return code wont be able to make
+ * queries anyhow.
+ */
+ RES_SET_H_ERRNO(statp, NETDB_INTERNAL);
+ maxns = 0;
+ }
#ifdef RESOLVSORT
statp->nsort = 0;
#endif
@@ -240,9 +256,9 @@
buf[0] = '.';
cp = strchr(buf, '.');
cp = (cp == NULL) ? buf : (cp + 1);
- if (strlen(cp) >= sizeof(statp->defdname))
- goto freedata;
- strcpy(statp->defdname, cp);
+ strncpy(statp->defdname, cp,
+ sizeof(statp->defdname) - 1);
+ statp->defdname[sizeof(statp->defdname) - 1] = '\0';
}
}
#endif /* SOLARIS2 */
@@ -348,7 +364,7 @@
continue;
}
/* read nameservers to query */
- if (MATCH(buf, "nameserver") && nserv < MAXNS) {
+ if (MATCH(buf, "nameserver") && nserv < maxns) {
struct addrinfo hints, *ai;
char sbuf[NI_MAXSERV];
const size_t minsiz =
@@ -541,16 +557,7 @@
else if ((cp = getenv("RES_OPTIONS")) != NULL)
res_setoptions(statp, cp, "env");
statp->options |= RES_INIT;
- return (0);
-
-#ifdef SOLARIS2
- freedata:
- if (statp->_u._ext.ext != NULL) {
- free(statp->_u._ext.ext);
- statp->_u._ext.ext = NULL;
- }
- return (-1);
-#endif
+ return (statp->res_h_errno);
}
static void
==== //depot/projects/dtrace7/src/sys/kern/init_main.c#4 (text+ko) ====
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/init_main.c,v 1.283.2.1 2007/12/06 14:19:42 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/init_main.c,v 1.283.2.2 2007/12/14 13:41:08 rrs Exp $");
#include "opt_ddb.h"
#include "opt_init_path.h"
@@ -488,10 +488,15 @@
p->p_sysent->sv_maxuser);
vmspace0.vm_map.pmap = vmspace_pmap(&vmspace0);
+ /*-
+ * call the init and ctor for the new thread and proc
+ * we wait to do this until all other structures
+ * are fairly sane.
+ */
+ EVENTHANDLER_INVOKE(process_init, p);
+ EVENTHANDLER_INVOKE(thread_init, td);
EVENTHANDLER_INVOKE(process_ctor, p);
- EVENTHANDLER_INVOKE(process_init, p);
EVENTHANDLER_INVOKE(thread_ctor, td);
- EVENTHANDLER_INVOKE(thread_init, td);
/*
* Charge root for one process.
==== //depot/projects/dtrace7/src/sys/kern/kern_proc.c#4 (text+ko) ====
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.252.2.1 2007/11/24 18:27:29 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.252.2.2 2007/12/14 13:41:08 rrs Exp $");
#include "opt_ktrace.h"
#include "opt_kstack_pages.h"
@@ -160,7 +160,7 @@
* freed, so you gotta do this here.
*/
if (((p->p_flag & P_KTHREAD) != 0) && (td->td_altkstack != 0))
- vm_thread_dispose_altkstack(td);
+ vm_thread_dispose_altkstack(td);
EVENTHANDLER_INVOKE(process_dtor, p);
if (p->p_ksi != NULL)
KASSERT(! KSI_ONQ(p->p_ksi), ("SIGCHLD queue"));
==== //depot/projects/dtrace7/src/sys/kern/kern_thread.c#3 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.255 2007/09/21 04:04:22 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.255.2.1 2007/12/14 13:41:09 rrs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -128,7 +128,6 @@
*/
td->td_critnest = 1;
EVENTHANDLER_INVOKE(thread_ctor, td);
-
#ifdef AUDIT
audit_thread_alloc(td);
#endif
==== //depot/projects/dtrace7/src/sys/sys/eventhandler.h#3 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/sys/eventhandler.h,v 1.37 2007/04/13 08:38:48 pjd Exp $
+ * $FreeBSD: src/sys/sys/eventhandler.h,v 1.37.2.1 2007/12/14 13:41:09 rrs Exp $
*/
#ifndef SYS_EVENTHANDLER_H
More information about the p4-projects
mailing list