Source-Changes-HG archive

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

[src/trunk]: src/sbin/restore Make a judicious choice as to whether to apply ...



details:   https://anonhg.NetBSD.org/src/rev/fa70211be6c9
branches:  trunk
changeset: 572576:fa70211be6c9
user:      fredb <fredb%NetBSD.org@localhost>
date:      Sat Jan 08 14:30:39 2005 +0000

description:
Make a judicious choice as to whether to apply the permissions
of the root inode of the dump to the current working directory,
rather than interrogate the user. Closes PR bin/24690. Reviewed
by bouyer, tron, imp.

diffstat:

 sbin/restore/dirs.c        |   7 +++----
 sbin/restore/interactive.c |   6 ++++--
 sbin/restore/main.c        |   7 +++++--
 sbin/restore/restore.8     |  19 ++++++++++++++++++-
 sbin/restore/restore.h     |   3 ++-
 5 files changed, 32 insertions(+), 10 deletions(-)

diffs (140 lines):

diff -r be5380742a28 -r fa70211be6c9 sbin/restore/dirs.c
--- a/sbin/restore/dirs.c       Sat Jan 08 10:04:35 2005 +0000
+++ b/sbin/restore/dirs.c       Sat Jan 08 14:30:39 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dirs.c,v 1.41 2004/10/22 22:38:38 bouyer Exp $ */
+/*     $NetBSD: dirs.c,v 1.42 2005/01/08 14:30:39 fredb Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)dirs.c     8.7 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: dirs.c,v 1.41 2004/10/22 22:38:38 bouyer Exp $");
+__RCSID("$NetBSD: dirs.c,v 1.42 2005/01/08 14:30:39 fredb Exp $");
 #endif
 #endif /* not lint */
 
@@ -636,8 +636,7 @@
                                ep->e_flags &= ~NEW;
                                continue;
                        }
-                       if (node.ino == ROOTINO &&
-                           reply("set owner/mode for '.'") == FAIL)
+                       if (node.ino == ROOTINO && dotflag == 0)
                                continue;
                }
                if (ep == NULL) {
diff -r be5380742a28 -r fa70211be6c9 sbin/restore/interactive.c
--- a/sbin/restore/interactive.c        Sat Jan 08 10:04:35 2005 +0000
+++ b/sbin/restore/interactive.c        Sat Jan 08 14:30:39 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: interactive.c,v 1.19 2003/08/07 10:04:37 agc Exp $     */
+/*     $NetBSD: interactive.c,v 1.20 2005/01/08 14:30:39 fredb Exp $   */
 
 /*
  * Copyright (c) 1985, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)interactive.c      8.5 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: interactive.c,v 1.19 2003/08/07 10:04:37 agc Exp $");
+__RCSID("$NetBSD: interactive.c,v 1.20 2005/01/08 14:30:39 fredb Exp $");
 #endif
 #endif /* not lint */
 
@@ -135,6 +135,8 @@
                ino = dirlookup(name);
                if (ino == 0)
                        break;
+               if (ino == ROOTINO)
+                       dotflag = 1;
                if (mflag)
                        pathcheck(name);
                treescan(name, ino, addfile);
diff -r be5380742a28 -r fa70211be6c9 sbin/restore/main.c
--- a/sbin/restore/main.c       Sat Jan 08 10:04:35 2005 +0000
+++ b/sbin/restore/main.c       Sat Jan 08 14:30:39 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.28 2004/10/24 17:01:07 wiz Exp $    */
+/*     $NetBSD: main.c,v 1.29 2005/01/08 14:30:39 fredb Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.28 2004/10/24 17:01:07 wiz Exp $");
+__RCSID("$NetBSD: main.c,v 1.29 2005/01/08 14:30:39 fredb Exp $");
 #endif
 #endif /* not lint */
 
@@ -76,6 +76,7 @@
 size_t pagesize;
 FILE   *terminal;
 char   *tmpdir;
+int    dotflag = 0;
 
 FILE *Mtreefile = NULL;
 
@@ -285,6 +286,8 @@
                        ino = dirlookup(name);
                        if (ino == 0)
                                continue;
+                       if (ino == ROOTINO)
+                               dotflag = 1;
                        if (mflag)
                                pathcheck(name);
                        treescan(name, ino, addfile);
diff -r be5380742a28 -r fa70211be6c9 sbin/restore/restore.8
--- a/sbin/restore/restore.8    Sat Jan 08 10:04:35 2005 +0000
+++ b/sbin/restore/restore.8    Sat Jan 08 14:30:39 2005 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: restore.8,v 1.47 2004/10/24 17:01:22 wiz Exp $
+.\"    $NetBSD: restore.8,v 1.48 2005/01/08 14:30:39 fredb Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -106,6 +106,23 @@
 the appearance of a directory name refers to
 the files and (recursively) subdirectories of that directory.
 .Pp
+If any file arguments are given with the
+.Fl x
+flag,
+or specified in the command shell with the
+.Fl i
+flag,
+the permissions of the root directory
+.Em will not
+be applied to the current directory,
+unless one of those file arguments explicitly represents the root inode
+.Po e.g.:
+a literal
+.Ql \&.
+.Pc .
+This is a change from the traditional behaviour,
+which used to be to always prompt the user.
+.Pp
 Exactly one of the following flags is required:
 .Bl -tag -width Ds
 .It Fl i
diff -r be5380742a28 -r fa70211be6c9 sbin/restore/restore.h
--- a/sbin/restore/restore.h    Sat Jan 08 10:04:35 2005 +0000
+++ b/sbin/restore/restore.h    Sat Jan 08 14:30:39 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: restore.h,v 1.16 2004/10/22 22:38:38 bouyer Exp $      */
+/*     $NetBSD: restore.h,v 1.17 2005/01/08 14:30:39 fredb Exp $       */
 
 /*
  * Copyright (c) 1983, 1993
@@ -49,6 +49,7 @@
 extern int     vflag;          /* print out actions taken */
 extern int     uflag;          /* unlink file before writing to it */
 extern int     yflag;          /* always try to recover from tape errors */
+extern int     dotflag;        /* restore owner/mode of "." directory */
 /*
  * Global variables
  */



Home | Main Index | Thread Index | Old Index