From owner-svn-src-all@freebsd.org Sun Jan 8 06:50:54 2017 Return-Path: Delivered-To: svn-src-all@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 EB681CA51EE; Sun, 8 Jan 2017 06:50:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 942E31BB2; Sun, 8 Jan 2017 06:50:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v086orEc031889; Sun, 8 Jan 2017 06:50:53 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v086or32031887; Sun, 8 Jan 2017 06:50:53 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201701080650.v086or32031887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Sun, 8 Jan 2017 06:50:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311668 - head/bin/chmod X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2017 06:50:55 -0000 Author: cem Date: Sun Jan 8 06:50:53 2017 New Revision: 311668 URL: https://svnweb.freebsd.org/changeset/base/311668 Log: chmod: Add SIGINFO handler PR: 191884 Submitted by: Dan McGregor Reviewed by: mjg@ (earlier version) Modified: head/bin/chmod/chmod.1 head/bin/chmod/chmod.c Modified: head/bin/chmod/chmod.1 ============================================================================== --- head/bin/chmod/chmod.1 Sun Jan 8 06:26:33 2017 (r311667) +++ head/bin/chmod/chmod.1 Sun Jan 8 06:50:53 2017 (r311668) @@ -32,7 +32,7 @@ .\" @(#)chmod.1 8.4 (Berkeley) 3/31/94 .\" $FreeBSD$ .\" -.Dd April 20, 2015 +.Dd January 7, 2017 .Dt CHMOD 1 .Os .Sh NAME @@ -106,6 +106,16 @@ option is specified. In addition, these options override each other and the command's actions are determined by the last one specified. .Pp +If +.Nm +receives a +.Dv SIGINFO +signal (see the +.Cm status +argument for +.Xr stty 1 ) , +then the current filename as well as the old and new modes are displayed. +.Pp Only the owner of a file or the super-user is permitted to change the mode of a file. .Sh EXIT STATUS Modified: head/bin/chmod/chmod.c ============================================================================== --- head/bin/chmod/chmod.c Sun Jan 8 06:26:33 2017 (r311667) +++ head/bin/chmod/chmod.c Sun Jan 8 06:50:53 2017 (r311668) @@ -49,14 +49,24 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include +static volatile sig_atomic_t siginfo; + static void usage(void); static int may_have_nfs4acl(const FTSENT *ent, int hflag); +static void +siginfo_handler(int sig __unused) +{ + + siginfo = 1; +} + int main(int argc, char *argv[]) { @@ -125,6 +135,8 @@ done: argv += optind; if (argc < 2) usage(); + (void)signal(SIGINFO, siginfo_handler); + if (Rflag) { if (hflag) errx(1, "the -R and -h options may not be " @@ -192,10 +204,10 @@ done: argv += optind; && !fflag) { warn("%s", p->fts_path); rval = 1; - } else if (vflag) { + } else if (vflag || siginfo) { (void)printf("%s", p->fts_path); - if (vflag > 1) { + if (vflag > 1 || siginfo) { char m1[12], m2[12]; strmode(p->fts_statp->st_mode, m1); @@ -207,6 +219,7 @@ done: argv += optind; newmode, m2); } (void)printf("\n"); + siginfo = 0; } } if (errno)