diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2010-08-02 13:40:53 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2010-08-02 13:40:53 +0000 |
commit | 577761e1812fe4592e28db32d4518e8cba986503 (patch) | |
tree | 3fd229f631527cecfed36a148a8b8d4077b143b5 /cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c | |
parent | 796dcddd184bb641110681caa8686cd769bc02ac (diff) | |
parent | 679969c11d8f283ad56fa4b5bbd853cd1e7aa8fa (diff) | |
download | FreeBSD-src-577761e1812fe4592e28db32d4518e8cba986503.zip FreeBSD-src-577761e1812fe4592e28db32d4518e8cba986503.tar.gz |
MFV OpenSolaris DTrace userland bits.
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c index 02fa507..3a5315e 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,19 +18,18 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <strings.h> #include <stdlib.h> #include <errno.h> #include <ctype.h> #include <dt_string.h> +#include <dt_impl.h> /* * Create a copy of string s, but only duplicate the first n bytes. @@ -41,6 +39,9 @@ strndup(const char *s, size_t n) { char *s2 = malloc(n + 1); + if (s2 == NULL) + longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); + (void) strncpy(s2, s, n); s2[n] = '\0'; return (s2); |