SCCS-vsn: sbin/fsck/fsck.8 6.5
SCCS-vsn: sbin/fsck/main.c 5.9
SCCS-vsn: sbin/fsck/dir.c 5.5
SCCS-vsn: sbin/fsck/fsck.h 5.8
SCCS-vsn: sbin/fsck/pass2.c 5.4
-static char sccsid[] = "@(#)dir.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)dir.c 5.5 (Berkeley) %G%";
#endif not lint
#include <sys/param.h>
#endif not lint
#include <sys/param.h>
char *endpathname = &pathname[BUFSIZ - 2];
char *lfname = "lost+found";
char *endpathname = &pathname[BUFSIZ - 2];
char *lfname = "lost+found";
struct dirtemplate emptydir = { 0, DIRBLKSIZ };
struct dirtemplate dirhead = { 0, 12, 1, ".", 0, DIRBLKSIZ - 12, 2, ".." };
struct dirtemplate emptydir = { 0, DIRBLKSIZ };
struct dirtemplate dirhead = { 0, 12, 1, ".", 0, DIRBLKSIZ - 12, 2, ".." };
} else {
pwarn("NO lost+found DIRECTORY");
if (preen || reply("CREATE")) {
} else {
pwarn("NO lost+found DIRECTORY");
if (preen || reply("CREATE")) {
- lfdir = allocdir(ROOTINO, 0);
+ lfdir = allocdir(ROOTINO, 0, lfmode);
if (lfdir != 0) {
if (makeentry(ROOTINO, lfdir, lfname) != 0) {
if (preen)
if (lfdir != 0) {
if (makeentry(ROOTINO, lfdir, lfname) != 0) {
if (preen)
if (reply("REALLOCATE") == 0)
return (0);
oldlfdir = lfdir;
if (reply("REALLOCATE") == 0)
return (0);
oldlfdir = lfdir;
- if ((lfdir = allocdir(ROOTINO, 0)) == 0) {
+ if ((lfdir = allocdir(ROOTINO, 0, lfmode)) == 0) {
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
return (0);
}
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
return (0);
}
/*
* allocate a new directory
*/
/*
* allocate a new directory
*/
-allocdir(parent, request)
+allocdir(parent, request, mode)
{
ino_t ino;
char *cp;
DINODE *dp;
register BUFAREA *bp;
{
ino_t ino;
char *cp;
DINODE *dp;
register BUFAREA *bp;
- ino = allocino(request, IFDIR|0755);
+ ino = allocino(request, IFDIR|mode);
dirhead.dot_ino = ino;
dirhead.dotdot_ino = parent;
dp = ginode(ino);
dirhead.dot_ino = ino;
dirhead.dotdot_ino = parent;
dp = ginode(ino);
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
-.\" @(#)fsck.8 6.4 (Berkeley) %G%
+.\" @(#)fsck.8 6.5 (Berkeley) %G%
filesystem
] ...
.SH DESCRIPTION
filesystem
] ...
.SH DESCRIPTION
the super block for the file system. Block 32 is usually
an alternate super block.
.TP 6
the super block for the file system. Block 32 is usually
an alternate super block.
.TP 6
+.B \-m
+Use the mode specified in octal immediately after the flag as the
+permission bits to use when creating the lost+found directory
+rather than the default 1777.
+In particular, systems that do not wish to have lost files accessible
+by all users on the system should use a more restrictive
+set of permissions such as 700.
+.TP 6
.B \-y
Assume a yes response to all questions asked by
.I fsck;
.B \-y
Assume a yes response to all questions asked by
.I fsck;
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)fsck.h 5.7 (Berkeley) %G%
+ * @(#)fsck.h 5.8 (Berkeley) %G%
*/
#define MAXDUP 10 /* limit on dup blks (per inode) */
*/
#define MAXDUP 10 /* limit on dup blks (per inode) */
ino_t lastino; /* hiwater mark of inodes */
ino_t lfdir; /* lost & found directory inode number */
char *lfname; /* lost & found directory name */
ino_t lastino; /* hiwater mark of inodes */
ino_t lfdir; /* lost & found directory inode number */
char *lfname; /* lost & found directory name */
+int lfmode; /* lost & found directory creation mode */
off_t maxblk; /* largest logical blk in file */
off_t bmapsz; /* num chars in blockmap */
off_t maxblk; /* largest logical blk in file */
off_t bmapsz; /* num chars in blockmap */
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)main.c 5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.9 (Berkeley) %G%";
#endif not lint
#include <sys/param.h>
#endif not lint
#include <sys/param.h>
#include <sys/wait.h>
#include <fstab.h>
#include <strings.h>
#include <sys/wait.h>
#include <fstab.h>
#include <strings.h>
#include "fsck.h"
char *rawname(), *unrawname(), *blockcheck();
#include "fsck.h"
char *rawname(), *unrawname(), *blockcheck();
+ case 'm':
+ if (!isdigit(argv[1][0]))
+ errexit("-m flag requires a mode\n");
+ sscanf(*++argv, "%o", &lfmode);
+ if (lfmode &~ 07777)
+ errexit("bad mode to -m: %o\n", lfmode);
+ argc--;
+ printf("** lost+found creation mode %o\n", lfmode);
+ break;
+
case 'n': /* default no answer flag */
case 'N':
nflag++;
case 'n': /* default no answer flag */
case 'N':
nflag++;
-static char sccsid[] = "@(#)pass2.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)pass2.c 5.4 (Berkeley) %G%";
#endif not lint
#include <sys/param.h>
#endif not lint
#include <sys/param.h>
pfatal("ROOT INODE UNALLOCATED");
if (reply("ALLOCATE") == 0)
errexit("");
pfatal("ROOT INODE UNALLOCATED");
if (reply("ALLOCATE") == 0)
errexit("");
- if (allocdir(ROOTINO, ROOTINO) != ROOTINO)
+ if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
descend(&rootdesc, ROOTINO);
break;
errexit("CANNOT ALLOCATE ROOT INODE\n");
descend(&rootdesc, ROOTINO);
break;
pfatal("DUPS/BAD IN ROOT INODE");
if (reply("REALLOCATE")) {
freeino(ROOTINO);
pfatal("DUPS/BAD IN ROOT INODE");
if (reply("REALLOCATE")) {
freeino(ROOTINO);
- if (allocdir(ROOTINO, ROOTINO) != ROOTINO)
+ if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
descend(&rootdesc, ROOTINO);
break;
errexit("CANNOT ALLOCATE ROOT INODE\n");
descend(&rootdesc, ROOTINO);
break;
pfatal("ROOT INODE NOT DIRECTORY");
if (reply("REALLOCATE")) {
freeino(ROOTINO);
pfatal("ROOT INODE NOT DIRECTORY");
if (reply("REALLOCATE")) {
freeino(ROOTINO);
- if (allocdir(ROOTINO, ROOTINO) != ROOTINO)
+ if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
descend(&rootdesc, ROOTINO);
break;
errexit("CANNOT ALLOCATE ROOT INODE\n");
descend(&rootdesc, ROOTINO);
break;