Module Name: src
Committed By: christos
Date: Fri Jan 23 02:27:01 UTC 2015
Modified Files:
src/usr.sbin/mtree: mtree.8 mtree.c verify.c
Log Message:
attempt to reset file flags when -rr
To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/mtree/mtree.8
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/mtree/mtree.c
cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/mtree/verify.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/mtree/mtree.8
diff -u src/usr.sbin/mtree/mtree.8:1.69 src/usr.sbin/mtree/mtree.8:1.70
--- src/usr.sbin/mtree/mtree.8:1.69 Sun Feb 3 14:16:06 2013
+++ src/usr.sbin/mtree/mtree.8 Thu Jan 22 21:27:01 2015
@@ -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 @@ is specified, remove all of the other ke
.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.
Index: src/usr.sbin/mtree/mtree.c
diff -u src/usr.sbin/mtree/mtree.c:1.49 src/usr.sbin/mtree/mtree.c:1.50
--- src/usr.sbin/mtree/mtree.c:1.49 Thu Apr 24 13:22:41 2014
+++ src/usr.sbin/mtree/mtree.c Thu Jan 22 21:27:01 2015
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
#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 @@ main(int argc, char **argv)
qflag = 1;
break;
case 'r':
- rflag = 1;
+ rflag++;
break;
case 'R':
while ((p = strsep(&optarg, " \t,")) != NULL)
Index: src/usr.sbin/mtree/verify.c
diff -u src/usr.sbin/mtree/verify.c:1.44 src/usr.sbin/mtree/verify.c:1.45
--- src/usr.sbin/mtree/verify.c:1.44 Sun Feb 3 14:15:17 2013
+++ src/usr.sbin/mtree/verify.c Thu Jan 22 21:27:01 2015
@@ -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 @@ vwalk(void)
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",