Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/mtree attempt to reset file flags when -rr



details:   https://anonhg.NetBSD.org/src/rev/350bce28e5ef
branches:  trunk
changeset: 335757:350bce28e5ef
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 23 02:27:01 2015 +0000

description:
attempt to reset file flags when -rr

diffstat:

 usr.sbin/mtree/mtree.8  |  8 ++++++--
 usr.sbin/mtree/mtree.c  |  6 +++---
 usr.sbin/mtree/verify.c |  8 ++++++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diffs (85 lines):

diff -r 7f540546a332 -r 350bce28e5ef usr.sbin/mtree/mtree.8
--- a/usr.sbin/mtree/mtree.8    Thu Jan 22 23:45:41 2015 +0000
+++ b/usr.sbin/mtree/mtree.8    Fri Jan 23 02:27:01 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: mtree.8,v 1.69 2013/02/03 19:16:06 christos Exp $
+.\"    $NetBSD: mtree.8,v 1.70 2015/01/23 02:27:01 christos Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -56,7 +56,7 @@
 .\"
 .\"     @(#)mtree.8    8.2 (Berkeley) 12/11/93
 .\"
-.Dd February 3, 2013
+.Dd January 22, 2014
 .Dt MTREE 8
 .Os
 .Sh NAME
@@ -299,6 +299,10 @@
 .It Fl r
 Remove any files in the file hierarchy that are not described in the
 specification.
+Repeating the flag more than once will attempt to reset all the
+file flags via
+.Xr lchflags 2
+before attempting to remove the file in case the file was immutable.
 .It Fl S
 When reading a specification into an internal data structure,
 sort the entries.
diff -r 7f540546a332 -r 350bce28e5ef usr.sbin/mtree/mtree.c
--- a/usr.sbin/mtree/mtree.c    Thu Jan 22 23:45:41 2015 +0000
+++ b/usr.sbin/mtree/mtree.c    Fri Jan 23 02:27:01 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mtree.c,v 1.49 2014/04/24 17:22:41 christos Exp $      */
+/*     $NetBSD: mtree.c,v 1.50 2015/01/23 02:27:01 christos Exp $      */
 
 /*-
  * Copyright (c) 1989, 1990, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)mtree.c    8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: mtree.c,v 1.49 2014/04/24 17:22:41 christos Exp $");
+__RCSID("$NetBSD: mtree.c,v 1.50 2015/01/23 02:27:01 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -195,7 +195,7 @@
                        qflag = 1;
                        break;
                case 'r':
-                       rflag = 1;
+                       rflag++;
                        break;
                case 'R':
                        while ((p = strsep(&optarg, " \t,")) != NULL)
diff -r 7f540546a332 -r 350bce28e5ef usr.sbin/mtree/verify.c
--- a/usr.sbin/mtree/verify.c   Thu Jan 22 23:45:41 2015 +0000
+++ b/usr.sbin/mtree/verify.c   Fri Jan 23 02:27:01 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: verify.c,v 1.44 2013/02/03 19:15:17 christos Exp $     */
+/*     $NetBSD: verify.c,v 1.45 2015/01/23 02:27:01 christos Exp $     */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)verify.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: verify.c,v 1.44 2013/02/03 19:15:17 christos Exp $");
+__RCSID("$NetBSD: verify.c,v 1.45 2015/01/23 02:27:01 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -149,6 +149,10 @@
                if (!eflag && !(dflag && p->fts_info == FTS_SL)) {
                        printf("extra: %s", RP(p));
                        if (rflag) {
+                               if (rflag > 1 &&
+                                   lchflags(p->fts_accpath, 0) == -1)
+                                       printf(" (chflags %s)",
+                                           strerror(errno));
                                if ((S_ISDIR(p->fts_statp->st_mode)
                                    ? rmdir : unlink)(p->fts_accpath)) {
                                        printf(", not removed: %s",



Home | Main Index | Thread Index | Old Index