From keramida@ceid.upatras.gr  Sun Sep 30 14:57:24 2007
Return-Path: <keramida@ceid.upatras.gr>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B2FE816A418
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 30 Sep 2007 14:57:24 +0000 (UTC)
	(envelope-from keramida@ceid.upatras.gr)
Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36])
	by mx1.freebsd.org (Postfix) with ESMTP id 2A14F13C458
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 30 Sep 2007 14:57:23 +0000 (UTC)
	(envelope-from keramida@ceid.upatras.gr)
Received: from kobe.laptop (dialup28.ach.sch.gr [81.186.70.28])
	(authenticated bits=128)
	by igloo.linux.gr (8.14.1/8.14.1/Debian-9) with ESMTP id l8UEfxSk002134
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 30 Sep 2007 17:42:11 +0300
Received: from kobe.laptop (kobe.laptop [127.0.0.1])
	by kobe.laptop (8.14.1/8.14.1) with ESMTP id l8UEfmVx001892
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 30 Sep 2007 17:41:57 +0300 (EEST)
	(envelope-from keramida@kobe.laptop)
Received: (from keramida@localhost)
	by kobe.laptop (8.14.1/8.14.1/Submit) id l8TLogsS006100;
	Sun, 30 Sep 2007 00:50:42 +0300 (EEST)
	(envelope-from keramida)
Message-Id: <200709292150.l8TLogsS006100@kobe.laptop>
Date: Sun, 30 Sep 2007 00:50:42 +0300 (EEST)
From: Giorgos Keramidas <keramida@freebsd.org>
Reply-To: Giorgos Keramidas <keramida@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: mtree should probably use getcwd()
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         116766
>Category:       bin
>Synopsis:       mtree(8) should probably use getcwd()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    keramida
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 30 15:00:04 GMT 2007
>Closed-Date:    Sat Dec 06 14:37:22 UTC 2008
>Last-Modified:  Sat Dec 06 14:37:22 UTC 2008
>Originator:     Giorgos Keramidas
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD kobe 7.0-CURRENT FreeBSD 7.0-CURRENT #0:
Fri Sep 21 19:09:58 EEST 2007 build@kobe:/home/build/obj/home/build/src/sys/KOBE i386

>Description:

While integrating mtree-like functionality in an autoconf-based
program, the following warning was issued by autoscan(1):

% janus:/k/mtree> autoscan
% src/mtree.c:167: warning: getwd is deprecated, use getcwd instead
% janus:/k/mtree>

>How-To-Repeat:
>Fix:

This is easy to fix, by using getcwd():

%%%
--- old/usr.sbin/mtree/mtree.c	Fri Sep 21 17:07:41 2007 +0300
+++ new/usr.sbin/mtree/mtree.c	Sun Sep 30 00:46:55 2007 +0300
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
 	if (dir && chdir(dir))
 		err(1, "%s", dir);
 
-	if ((cflag || sflag) && !getwd(fullpath))
+	if ((cflag || sflag) && !getcwd(fullpath, sizeof(fullpath)))
 		errx(1, "%s", fullpath);
 
 	if (cflag) {
%%%

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: keramida 
State-Changed-When: Tue Jan 15 02:14:52 UTC 2008 
State-Changed-Why:  
Patch committed to HEAD as mtree.c -r 1.30 and to RELENG_6 
as -r 1.29.8.1.  Leaving the problem report to `patched' state 
until I MFC this to RELENG_7 too. 


Responsible-Changed-From-To: freebsd-bugs->keramida 
Responsible-Changed-By: keramida 
Responsible-Changed-When: Tue Jan 15 02:14:52 UTC 2008 
Responsible-Changed-Why:  
I'll handle MFC'ing this to RELENG_7 as needed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116766 
State-Changed-From-To: patched->closed 
State-Changed-By: keramida 
State-Changed-When: Sat Dec 6 14:36:17 UTC 2008 
State-Changed-Why:  
Patched in stable/6, stable/7 and releng/7.1 now. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116766 
>Unformatted:
