kern_environment.c (95839) | kern_environment.c (105354) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Michael Smith 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/kern/kern_environment.c 95839 2002-05-01 02:51:50Z peter $ | 26 * $FreeBSD: head/sys/kern/kern_environment.c 105354 2002-10-17 20:03:38Z robert $ |
27 */ 28 29/* 30 * The unified bootloader passes us a pointer to a preserved copy of 31 * bootstrap/kernel environment variables. We convert them to a 32 * dynamic array of strings later when the VM subsystem is up. 33 * 34 * We make these available through the kenv(2) syscall for userland --- 332 unchanged lines hidden (view full) --- 367 */ 368int 369getenv_string(const char *name, char *data, int size) 370{ 371 char *tmp; 372 373 tmp = getenv(name); 374 if (tmp != NULL) { | 27 */ 28 29/* 30 * The unified bootloader passes us a pointer to a preserved copy of 31 * bootstrap/kernel environment variables. We convert them to a 32 * dynamic array of strings later when the VM subsystem is up. 33 * 34 * We make these available through the kenv(2) syscall for userland --- 332 unchanged lines hidden (view full) --- 367 */ 368int 369getenv_string(const char *name, char *data, int size) 370{ 371 char *tmp; 372 373 tmp = getenv(name); 374 if (tmp != NULL) { |
375 strncpy(data, tmp, size); | 375 strlcpy(data, tmp, size); |
376 freeenv(tmp); | 376 freeenv(tmp); |
377 data[size - 1] = 0; | |
378 return (1); 379 } else 380 return (0); 381} 382 383/* 384 * Return an integer value from an environment variable. 385 */ --- 76 unchanged lines hidden --- | 377 return (1); 378 } else 379 return (0); 380} 381 382/* 383 * Return an integer value from an environment variable. 384 */ --- 76 unchanged lines hidden --- |