From owner-svn-src-head@freebsd.org Fri Jul 31 16:13:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 039C19AFD24 for ; Fri, 31 Jul 2015 16:13:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm22-vm1.bullet.mail.bf1.yahoo.com (nm22-vm1.bullet.mail.bf1.yahoo.com [98.139.212.127]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9439C1E12 for ; Fri, 31 Jul 2015 16:13:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1438359188; bh=4xGs2ie1W/GywnpFC0sWg5kGKcSqfhWd0A7LkCOBSoQ=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=IdWCN/t8A9pq054SitcvPkAGGspRyMBgDE/D9Dlm6+HYShOCivvMl7ShatqDcnK7DCygunf66lPHPl6/qhzFg1zp6WulHLBapKVt4aKiDbhpJ3F29bAjGvaxX03m9BQ6nnhtm1TDEg7iLbD/2fJH2kLYv1uhzS/b4gN0jJfOKti11m75pM+3k9IJMP0ABwK3wyu9hqt3AGMQ7zumpU+gQD8ruF6DtN+FKleNb+0xeodhByueLxxWlDzVDauRcJryHRMey9eKk/j2KM6J+n6u7gUiTbX9s4Bn81oy3XJ/iAu2nVHU94PN90wWn4KAA8moGMYWQk5b22gclC/BzdmhLw== Received: from [98.139.215.141] by nm22.bullet.mail.bf1.yahoo.com with NNFMP; 31 Jul 2015 16:13:08 -0000 Received: from [68.142.230.78] by tm12.bullet.mail.bf1.yahoo.com with NNFMP; 31 Jul 2015 16:13:08 -0000 Received: from [127.0.0.1] by smtp235.mail.bf1.yahoo.com with NNFMP; 31 Jul 2015 16:13:08 -0000 X-Yahoo-Newman-Id: 923326.9687.bm@smtp235.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: VsMciOAVM1lBUS.4lQ_1oiKYSg2QMQZ7vk7NIEj8iNCmdaW OBF446Ui.YFo0efOX0FSS.GYI1.P6ji2396P_vMiTqVJRxPMgkg1bnDWSHWo jY5CRNQ08t7EYURpmgt_NXHvE_rNrVWDaKSLbgVsMkX13JkIDqAQ8uQKI_Lo B2Py_lmPZpf40BdYf_GuRrnvto2oBcxnBz9MqvmGRXbGiWrXTGO58rbxrreC uyLtsCuFbB855FK86j_v1YtFT508me1KxW0X0l17Fu8IqX_Imr2Lcig1W4NZ 4E1ODlRUCex7BkK2P3AgrHN7UJRORx0I2WzP.BXO9xRvOtc2YUllkYv1t60S Kqoi4D7sLfvWrVhVXxFDnGVsvWtjWgL02ph3f18KtGNZ4KuPsxLgB9JO4EPY 5vTtvewF9Pb4DqSyDYWCSwyQtrzJqgkyQ9PSAA.wNaBOLxPhCPOdDSbhytW_ 0NcCZA9h1cMSRr3tRRrv3ge5Sa38UmgQx8gUQU3QOAspbuGIaJ34aMUjasRy CBRtYoalj40L0QGYxXh9OxUtyVmn3WK9. X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r286102 - head/usr.bin/wall To: Bruce Evans References: <201507310112.t6V1CWh8034232@repo.freebsd.org> <20150731162408.M1843@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <55BB9E9C.9030608@FreeBSD.org> Date: Fri, 31 Jul 2015 11:13:16 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20150731162408.M1843@besplex.bde.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 16:13:12 -0000 On 07/31/15 02:12, Bruce Evans wrote: > On Fri, 31 Jul 2015, Pedro F. Giffuni wrote: > ... > >> static char errbuf[1024]; > > Another static buffer. The function is obviously not reentrant. This > large static buffer mainly wastes space all the time instead of only > when the function is called. > But if I drop that static I get a bunch of errors: /usr/src/usr.bin/wall/ttymsg.c:82:11: error: address of stack memory associated with local variable 'errbuf' returned [-Werror,-Wreturn-stack-address] return (errbuf); ^~~~~~ /usr/src/usr.bin/wall/ttymsg.c:94:11: error: address of stack memory associated with local variable 'errbuf' returned [-Werror,-Wreturn-stack-address] return (errbuf); ^~~~~~ /usr/src/usr.bin/wall/ttymsg.c:134:13: error: address of stack memory associated with local variable 'errbuf' returned [-Werror,-Wreturn-stack-address] return (errbuf); ^~~~~~ /usr/src/usr.bin/wall/ttymsg.c:160:11: error: address of stack memory associated with local variable 'errbuf' returned [-Werror,-Wreturn-stack-address] return (errbuf); ^~~~~~ ... >> char *p; >> int forked; >> @@ -71,8 +71,8 @@ ttymsg(struct iovec *iov, int iovcnt, co >> if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) >> return ("too many iov's (change code in wall/ttymsg.c)"); >> >> + strlcat(device, line, sizeof(device)); > > This depends on the slow reinitialization on every entry. The combined > initialization (initializer + strlcat) is an obfuscated way of > concatenating 2 strings. The clearest way is snprintf with %s%s format. > I will do that, thanks. Pedro.