Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst use proper format strings in replace().



details:   https://anonhg.NetBSD.org/src/rev/e41c366280b7
branches:  trunk
changeset: 999846:e41c366280b7
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jun 20 15:58:59 2019 +0000

description:
use proper format strings in replace().

diffstat:

 usr.sbin/sysinst/configmenu.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 7c13a4ae442a -r e41c366280b7 usr.sbin/sysinst/configmenu.c
--- a/usr.sbin/sysinst/configmenu.c     Thu Jun 20 15:56:41 2019 +0000
+++ b/usr.sbin/sysinst/configmenu.c     Thu Jun 20 15:58:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: configmenu.c,v 1.7 2019/06/20 00:43:55 christos Exp $ */
+/* $NetBSD: configmenu.c,v 1.8 2019/06/20 15:58:59 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -295,7 +295,6 @@
 {
        configinfo **confp = arg;
        char additional_pkgs[STRSIZE] = {0};
-       char pattern[STRSIZE];
        int allok = 0;
        arg_rv parm;
 
@@ -316,8 +315,8 @@
        } while (allok == 0);
 
        /* configure pkgin to use $pkgpath as a repository */
-       snprintf(pattern, STRSIZE, "s,^[^#].*$,%s,", pkgpath);
-       replace("/usr/pkg/etc/pkgin/repositories.conf", pattern);
+       replace("/usr/pkg/etc/pkgin/repositories.conf", "s,^[^#].*$,%s,",
+           pkgpath);
 
        run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT,
                "/usr/pkg/bin/pkgin -y update");
@@ -425,7 +424,7 @@
                        fprintf(logfp, "replacement pattern is %s\n", pattern);
                        fflush(logfp);
                }
-               replace("/etc/rc.conf", pattern);
+               replace("/etc/rc.conf", "%s", pattern);
        }
 
        return 0;



Home | Main Index | Thread Index | Old Index