From owner-cvs-all Fri Jun 26 21:50:06 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA11318 for cvs-all-outgoing; Fri, 26 Jun 1998 21:50:06 -0700 (PDT) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id VAA11233 for ; Fri, 26 Jun 1998 21:50:00 -0700 (PDT) (envelope-from imp@village.org) Received: from harmony [10.0.0.6] by rover.village.org with esmtp (Exim 1.71 #1) id 0ypmvu-0000Fp-00; Fri, 26 Jun 1998 22:49:50 -0600 Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.8.8/8.8.3) with ESMTP id WAA02497; Fri, 26 Jun 1998 22:49:19 -0600 (MDT) Message-Id: <199806270449.WAA02497@harmony.village.org> To: John Birrell Subject: Re: Changes to make (not) Cc: committers@FreeBSD.ORG In-reply-to: Your message of "Sat, 27 Jun 1998 14:36:09 +1000." <199806270436.OAA15514@cimlogic.com.au> References: <199806270436.OAA15514@cimlogic.com.au> Date: Fri, 26 Jun 1998 22:49:19 -0600 From: Warner Losh Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk In message <199806270436.OAA15514@cimlogic.com.au> John Birrell writes: : Please avoid making changes to make(1) sources that rely on functions : that aren't commonly available in other versions of UNIX. The recent : changes that involve asprintf() mean that I can't do a bootstrap build : of the FreeBSD sources using NetBSD/Alpha. This is not so much a problem : to me now that I don't rely on doing that, but there are some who _are_. Any objections to committing the following patch? I think that we should make life easier for the FreeBSD/alpha effort, and this patch would do that. There really is no reason to use asprintf here since the length of the args is easy to calculate and it gets in the way of the alpha porting effort. I added the comment about sprintf being safe to prevent it from being GC'd into snprintf or asprintf by a future autitor.... Warner Index: main.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/usr.bin/make/main.c,v retrieving revision 1.24 diff -u -r1.24 main.c --- main.c 1998/06/13 11:55:57 1.24 +++ main.c 1998/06/27 04:45:54 @@ -186,9 +186,11 @@ break; case 'V': printVars = TRUE; - (void)asprintf(&p, "${%s}", optarg); + p = malloc(strlen(optarg) + 1 + 3); if (!p) Punt("make: cannot allocate memory."); + /* This sprintf is safe, because of the malloc above */ + (void)sprintf(&p, "${%s}", optarg); (void)Lst_AtEnd(variables, (ClientData)p); Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL); Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message