diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2007-01-24 13:24:59 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2007-01-24 13:24:59 +0000 |
commit | 5aa69c79db630d14354e003c7888ba9f2f726433 (patch) | |
tree | 42f6ef0669768cfe3dbed2dbfe27d482926f7780 /sbin/fsck_ffs | |
parent | 85aa5c0549251ff80ea2a312c425cbb4a518da47 (diff) |
A reallocated root directory gets ownership of the fsck process.
If lost+found is created, it gets ownership of the root directory.
ok pedro
Diffstat (limited to 'sbin/fsck_ffs')
-rw-r--r-- | sbin/fsck_ffs/dir.c | 12 | ||||
-rw-r--r-- | sbin/fsck_ffs/inode.c | 7 |
2 files changed, 15 insertions, 4 deletions
diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index 365944d5524..1d014c74eca 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.17 2004/07/05 02:31:54 pvalchev Exp $ */ +/* $OpenBSD: dir.c,v 1.18 2007/01/24 13:24:58 bluhm Exp $ */ /* $NetBSD: dir.c,v 1.20 1996/09/27 22:45:11 christos Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94"; #else -static const char rcsid[] = "$OpenBSD: dir.c,v 1.17 2004/07/05 02:31:54 pvalchev Exp $"; +static const char rcsid[] = "$OpenBSD: dir.c,v 1.18 2007/01/24 13:24:58 bluhm Exp $"; #endif #endif /* not lint */ @@ -608,6 +608,8 @@ int allocdir(ino_t parent, ino_t request, int mode) { ino_t ino; + uid_t uid; + gid_t gid; char *cp; struct ufs1_dinode *dp; struct bufarea *bp; @@ -655,6 +657,12 @@ allocdir(ino_t parent, ino_t request, int mode) } dp = ginode(parent); dp->di_nlink++; + uid = dp->di_uid; + gid = dp->di_gid; + inodirty(); + dp = ginode(ino); + dp->di_uid = uid; + dp->di_gid = gid; inodirty(); return (ino); } diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index cc247a4a0b1..4d0484d3cb5 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inode.c,v 1.26 2003/10/11 01:43:45 tedu Exp $ */ +/* $OpenBSD: inode.c,v 1.27 2007/01/24 13:24:58 bluhm Exp $ */ /* $NetBSD: inode.c,v 1.23 1996/10/11 20:15:47 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95"; #else -static const char rcsid[] = "$OpenBSD: inode.c,v 1.26 2003/10/11 01:43:45 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: inode.c,v 1.27 2007/01/24 13:24:58 bluhm Exp $"; #endif #endif /* not lint */ @@ -49,6 +49,7 @@ static const char rcsid[] = "$OpenBSD: inode.c,v 1.26 2003/10/11 01:43:45 tedu E #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include "fsck.h" #include "fsutil.h" @@ -588,6 +589,8 @@ allocino(ino_t request, int type) return (0); } dp->di_mode = type; + dp->di_uid = geteuid(); + dp->di_gid = getegid(); dp->di_flags = 0; (void)time(&t); dp->di_atime = t; |