Date: Sun, 30 Sep 2007 00:50:42 +0300 (EEST) From: Giorgos Keramidas <keramida@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/116766: mtree should probably use getcwd() Message-ID: <200709292150.l8TLogsS006100@kobe.laptop> Resent-Message-ID: <200709301500.l8UF05gc080504@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 116766
>Category: bin
>Synopsis: mtree should probably use getcwd()
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Sep 30 15:00:04 GMT 2007
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709292150.l8TLogsS006100>
