kern_shutdown.c (242439) | kern_shutdown.c (242489) |
---|---|
1/*- 2 * Copyright (c) 1986, 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1986, 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/kern_shutdown.c 242439 2012-11-01 17:01:05Z alfred $"); | 38__FBSDID("$FreeBSD: head/sys/kern/kern_shutdown.c 242489 2012-11-02 18:57:38Z alfred $"); |
39 40#include "opt_ddb.h" 41#include "opt_kdb.h" 42#include "opt_panic.h" 43#include "opt_sched.h" 44#include "opt_watchdog.h" 45 46#include <sys/param.h> --- 668 unchanged lines hidden (view full) --- 715static char dumpdevname[sizeof(((struct cdev*)NULL)->si_name)]; 716SYSCTL_STRING(_kern_shutdown, OID_AUTO, dumpdevname, CTLFLAG_RD, 717 dumpdevname, 0, "Device for kernel dumps"); 718 719/* Registration of dumpers */ 720int 721set_dumper(struct dumperinfo *di, const char *devname) 722{ | 39 40#include "opt_ddb.h" 41#include "opt_kdb.h" 42#include "opt_panic.h" 43#include "opt_sched.h" 44#include "opt_watchdog.h" 45 46#include <sys/param.h> --- 668 unchanged lines hidden (view full) --- 715static char dumpdevname[sizeof(((struct cdev*)NULL)->si_name)]; 716SYSCTL_STRING(_kern_shutdown, OID_AUTO, dumpdevname, CTLFLAG_RD, 717 dumpdevname, 0, "Device for kernel dumps"); 718 719/* Registration of dumpers */ 720int 721set_dumper(struct dumperinfo *di, const char *devname) 722{ |
723 size_t wantcopy; |
|
723 724 if (di == NULL) { 725 bzero(&dumper, sizeof dumper); 726 dumpdevname[0] = '\0'; 727 return (0); 728 } 729 if (dumper.dumper != NULL) 730 return (EBUSY); 731 dumper = *di; | 724 725 if (di == NULL) { 726 bzero(&dumper, sizeof dumper); 727 dumpdevname[0] = '\0'; 728 return (0); 729 } 730 if (dumper.dumper != NULL) 731 return (EBUSY); 732 dumper = *di; |
732 strlcpy(dumpdevname, devname, sizeof(dumpdevname)); 733 if (strlen(dumpdevname) != strlen(devname)) { | 733 wantcopy = strlcpy(dumpdevname, devname, sizeof(dumpdevname)); 734 if (wantcopy >= sizeof(dumpdevname)) { |
734 printf("set_dumper: device name truncated from '%s' -> '%s'\n", 735 devname, dumpdevname); 736 } 737 return (0); 738} 739 740/* Call dumper with bounds checking. */ 741int --- 34 unchanged lines hidden --- | 735 printf("set_dumper: device name truncated from '%s' -> '%s'\n", 736 devname, dumpdevname); 737 } 738 return (0); 739} 740 741/* Call dumper with bounds checking. */ 742int --- 34 unchanged lines hidden --- |