Module Name: src
Committed By: christos
Date: Wed Mar 26 08:40:58 UTC 2014
Modified Files:
src/sys/arch/sparc64/dev: pci_machdep.c
src/sys/arch/sparc64/sparc64: autoconf.c
Log Message:
kill sprintf
To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/sparc64/dev/pci_machdep.c
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/sparc64/sparc64/autoconf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/sparc64/dev/pci_machdep.c
diff -u src/sys/arch/sparc64/dev/pci_machdep.c:1.75 src/sys/arch/sparc64/dev/pci_machdep.c:1.76
--- src/sys/arch/sparc64/dev/pci_machdep.c:1.75 Sat Oct 27 13:18:12 2012
+++ src/sys/arch/sparc64/dev/pci_machdep.c Wed Mar 26 04:40:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.75 2012/10/27 17:18:12 chs Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.76 2014/03/26 08:40:58 christos Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.75 2012/10/27 17:18:12 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.76 2014/03/26 08:40:58 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -371,7 +371,7 @@ pci_intr_string(pci_chipset_tag_t pc, pc
{
static char str[16];
- sprintf(str, "ivec %x", ih);
+ snprintf(str, sizeof(str), "ivec %x", ih);
DPRINTF(SPDB_INTR, ("pci_intr_string: returning %s\n", str));
return (str);
Index: src/sys/arch/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.193 src/sys/arch/sparc64/sparc64/autoconf.c:1.194
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.193 Fri Feb 21 13:00:09 2014
+++ src/sys/arch/sparc64/sparc64/autoconf.c Wed Mar 26 04:40:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.193 2014/02/21 18:00:09 palle Exp $ */
+/* $NetBSD: autoconf.c,v 1.194 2014/03/26 08:40:58 christos Exp $ */
/*
* Copyright (c) 1996
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.193 2014/02/21 18:00:09 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.194 2014/03/26 08:40:58 christos Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -512,14 +512,14 @@ clockfreq(long freq)
{
char *p;
static char sbuf[10];
+ size_t len;
freq /= 1000;
- sprintf(sbuf, "%ld", freq / 1000);
+ len = snprintf(sbuf, sizeof(sbuf), "%ld", freq / 1000);
freq %= 1000;
if (freq) {
freq += 1000; /* now in 1000..1999 */
- p = sbuf + strlen(sbuf);
- sprintf(p, "%ld", freq);
+ snprintf(sbuf + len, sizeof(sbuf) - len, "%ld", freq);
*p = '.'; /* now sbuf = %d.%3d */
}
return (sbuf);
@@ -807,10 +807,11 @@ dev_path_drive_match(device_t dev, int c
* what we realy do here is to match "target" and "lun".
*/
if (wwn)
- sprintf(buf, "%s@w%016" PRIx64 ",%d", name, wwn,
- lun);
+ snprintf(buf, sizeof(buf), "%s@w%016" PRIx64 ",%d",
+ name, wwn, lun);
else
- sprintf(buf, "%s@%d,%d", name, target, lun);
+ snprintf(buf, sizeof(buf), "%s@%d,%d",
+ name, target, lun);
if (ofboottarget && strcmp(buf, ofboottarget) == 0) {
booted_device = dev;
if (ofbootpartition)