Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/mkdep mkdep: fix string constness in call to findcc



details:   https://anonhg.NetBSD.org/src/rev/958a31cf0243
branches:  trunk
changeset: 985349:958a31cf0243
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Aug 20 04:23:56 2021 +0000

description:
mkdep: fix string constness in call to findcc

diffstat:

 usr.bin/mkdep/mkdep.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 114fb2b4ce00 -r 958a31cf0243 usr.bin/mkdep/mkdep.c
--- a/usr.bin/mkdep/mkdep.c     Thu Aug 19 22:17:56 2021 +0000
+++ b/usr.bin/mkdep/mkdep.c     Fri Aug 20 04:23:56 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkdep.c,v 1.45 2018/05/23 21:20:20 joerg Exp $ */
+/* $NetBSD: mkdep.c,v 1.46 2021/08/20 04:23:56 rillig Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #if !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\
  All rights reserved.");
-__RCSID("$NetBSD: mkdep.c,v 1.45 2018/05/23 21:20:20 joerg Exp $");
+__RCSID("$NetBSD: mkdep.c,v 1.46 2021/08/20 04:23:56 rillig Exp $");
 #endif /* not lint */
 
 #include <sys/mman.h>
@@ -95,7 +95,9 @@
 static int
 run_cc(int argc, char **argv, const char **fname)
 {
-       const char *CC, *tmpdir;
+       static char default_cc[] = DEFAULT_CC;
+       char *CC;
+       const char *tmpdir;
        char * volatile pathname;
        static char tmpfilename[MAXPATHLEN];
        char **args;
@@ -104,7 +106,7 @@
        int status;
 
        if ((CC = getenv("CC")) == NULL)
-               CC = DEFAULT_CC;
+               CC = default_cc;
        if ((pathname = findcc(CC)) == NULL)
                if (!setenv("PATH", DEFAULT_PATH, 1))
                        pathname = findcc(CC);



Home | Main Index | Thread Index | Old Index