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.
This commit is contained in:
fredb 2005-01-08 14:30:39 +00:00
parent bd32b71189
commit 57aad81b8e
5 changed files with 32 additions and 10 deletions

View File

@ -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 @@ setdirmodes(flags)
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) {

View File

@ -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 @@ loop:
ino = dirlookup(name);
if (ino == 0)
break;
if (ino == ROOTINO)
dotflag = 1;
if (mflag)
pathcheck(name);
treescan(name, ino, addfile);

View File

@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#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 @@ time_t dumpdate;
size_t pagesize;
FILE *terminal;
char *tmpdir;
int dotflag = 0;
FILE *Mtreefile = NULL;
@ -285,6 +286,8 @@ main(argc, argv)
ino = dirlookup(name);
if (ino == 0)
continue;
if (ino == ROOTINO)
dotflag = 1;
if (mflag)
pathcheck(name);
treescan(name, ino, addfile);

View File

@ -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 @@ flag is specified (see below),
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

View File

@ -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 Nflag; /* do not write the disk */
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
*/