From owner-svn-src-head@FreeBSD.ORG Wed Sep 2 05:27:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A103106568F; Wed, 2 Sep 2009 05:27:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E1DC8FC0A; Wed, 2 Sep 2009 05:27:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n825Qxnt082836; Wed, 2 Sep 2009 05:26:59 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n825QxaP082834; Wed, 2 Sep 2009 05:26:59 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909020526.n825QxaP082834@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 2 Sep 2009 05:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196753 - head/bin/chmod X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 02 Sep 2009 05:27:00 -0000 Author: trasz Date: Wed Sep 2 05:26:59 2009 New Revision: 196753 URL: http://svn.freebsd.org/changeset/base/196753 Log: - Don't include both and - Keep variables sorted - Fix logic error with -f and -v options - don't print the usual -v output if there was an error, whether or not we were passed -f - Don't call free(3) just before exit(2) - Whitespace fixes Submitted by: bde Modified: head/bin/chmod/chmod.c Modified: head/bin/chmod/chmod.c ============================================================================== --- head/bin/chmod/chmod.c Wed Sep 2 04:56:30 2009 (r196752) +++ head/bin/chmod/chmod.c Wed Sep 2 05:26:59 2009 (r196753) @@ -41,7 +41,6 @@ static char sccsid[] = "@(#)chmod.c 8.8 #include __FBSDID("$FreeBSD$"); -#include #include #include @@ -63,7 +62,7 @@ main(int argc, char *argv[]) FTS *ftsp; FTSENT *p; mode_t *set; - int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval, error; + int Hflag, Lflag, Rflag, ch, error, fflag, fts_options, hflag, rval; int vflag; char *mode; mode_t newmode; @@ -170,7 +169,6 @@ done: argv += optind; */ if (!hflag) continue; - /* else */ /* FALLTHROUGH */ default: break; @@ -188,9 +186,11 @@ done: argv += optind; error = lchmod(p->fts_accpath, newmode); else error = chmod(p->fts_accpath, newmode); - if (error && !fflag) { - warn("%s", p->fts_path); - rval = 1; + if (error) { + if (!fflag) { + warn("%s", p->fts_path); + rval = 1; + } } else { if (vflag) { (void)printf("%s", p->fts_path); @@ -201,7 +201,6 @@ done: argv += optind; strmode(p->fts_statp->st_mode, m1); strmode((p->fts_statp->st_mode & S_IFMT) | newmode, m2); - (void)printf(": 0%o [%s] -> 0%o [%s]", p->fts_statp->st_mode, m1, (p->fts_statp->st_mode & S_IFMT) | @@ -209,12 +208,10 @@ done: argv += optind; } (void)printf("\n"); } - } } if (errno) err(1, "fts_read"); - free(set); exit(rval); }