Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sgimips kill sprintf.



details:   https://anonhg.NetBSD.org/src/rev/4900bbc11278
branches:  trunk
changeset: 328104:4900bbc11278
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 26 16:16:06 2014 +0000

description:
kill sprintf.

diffstat:

 sys/arch/sgimips/mace/pci_mace.c       |  6 +++---
 sys/arch/sgimips/sgimips/arcemu.c      |  6 +++---
 sys/arch/sgimips/stand/common/boot.c   |  8 +++++---
 sys/arch/sgimips/stand/sgivol/sgivol.c |  5 +++--
 4 files changed, 14 insertions(+), 11 deletions(-)

diffs (101 lines):

diff -r 8f30e143abd3 -r 4900bbc11278 sys/arch/sgimips/mace/pci_mace.c
--- a/sys/arch/sgimips/mace/pci_mace.c  Wed Mar 26 16:10:20 2014 +0000
+++ b/sys/arch/sgimips/mace/pci_mace.c  Wed Mar 26 16:16:06 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_mace.c,v 1.15 2012/10/27 17:18:10 chs Exp $        */
+/*     $NetBSD: pci_mace.c,v 1.16 2014/03/26 16:16:06 christos Exp $   */
 
 /*
  * Copyright (c) 2001,2003 Christopher Sekiya
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.15 2012/10/27 17:18:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.16 2014/03/26 16:16:06 christos Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -252,7 +252,7 @@
 {
        static char irqstr[32];
 
-       sprintf(irqstr, "crime interrupt %d", ih);
+       snprintf(irqstr, sizeof(irqstr), "crime interrupt %d", ih);
        return irqstr;
 }
 
diff -r 8f30e143abd3 -r 4900bbc11278 sys/arch/sgimips/sgimips/arcemu.c
--- a/sys/arch/sgimips/sgimips/arcemu.c Wed Mar 26 16:10:20 2014 +0000
+++ b/sys/arch/sgimips/sgimips/arcemu.c Wed Mar 26 16:16:06 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arcemu.c,v 1.21 2011/07/01 18:54:32 dyoung Exp $       */
+/*     $NetBSD: arcemu.c,v 1.22 2014/03/26 16:16:06 christos Exp $     */
 
 /*
  * Copyright (c) 2004 Steve Rumble 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arcemu.c,v 1.21 2011/07/01 18:54:32 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arcemu.c,v 1.22 2014/03/26 16:16:06 christos Exp $");
 
 #ifndef _LP64
 
@@ -298,7 +298,7 @@
        }
 
        /* cache enaddr string */
-       sprintf(enaddr, "%02x:%02x:%02x:%02x:%02x:%02x",
+       snprintf(enaddr, sizeof(enaddr), "%02x:%02x:%02x:%02x:%02x:%02x",
            nvram.enaddr[0],
            nvram.enaddr[1],
            nvram.enaddr[2],
diff -r 8f30e143abd3 -r 4900bbc11278 sys/arch/sgimips/stand/common/boot.c
--- a/sys/arch/sgimips/stand/common/boot.c      Wed Mar 26 16:10:20 2014 +0000
+++ b/sys/arch/sgimips/stand/common/boot.c      Wed Mar 26 16:16:06 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot.c,v 1.19 2011/02/20 07:59:52 matt Exp $   */
+/*     $NetBSD: boot.c,v 1.20 2014/03/26 16:16:06 christos Exp $       */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -160,14 +160,16 @@
         */
 
        if (strstr(argv[0], "cdrom(")) {
+               char *ep =
                strcpy(bootfile, argv[0]);
-               i = (strrchr(bootfile, ')') - bootfile);
+               ep = strrchr(bootfile, ')');
+               i =  ep - bootfile;
                bootfile[i - 1] = '0';
                if (strstr(bootfile, "ip3x"))
                        kernel = "ip3x";
                else
                        kernel = "ip2x";
-               sprintf((strrchr(bootfile, ')') + 1), kernel);
+               strcpy(ep + 1, kernel);
                if ((loadfile(bootfile, marks, LOAD_KERNEL)) >= 0)
                        goto finish;
        }
diff -r 8f30e143abd3 -r 4900bbc11278 sys/arch/sgimips/stand/sgivol/sgivol.c
--- a/sys/arch/sgimips/stand/sgivol/sgivol.c    Wed Mar 26 16:10:20 2014 +0000
+++ b/sys/arch/sgimips/stand/sgivol/sgivol.c    Wed Mar 26 16:16:06 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sgivol.c,v 1.19 2013/06/27 21:24:08 christos Exp $     */
+/*     $NetBSD: sgivol.c,v 1.20 2014/03/26 16:16:06 christos Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -206,7 +206,8 @@
                perror("File open");
                exit(1);
 #else
-               sprintf((char *)buf, "/dev/r%s%c", argv[0], 'a' + getrawpartition());
+               snprintf(buf, sizeof(buf), "/dev/r%s%c", argv[0],
+                   'a' + getrawpartition());
                fd = open((char *)buf, (opt_i | opt_w | opt_d | opt_p) 
                                ? O_RDWR : O_RDONLY);
                if (fd < 0) {



Home | Main Index | Thread Index | Old Index