summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-06-24 19:10:40 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-06-24 19:10:40 +0000
commit1fdcdda2a09e9e0bdfc3cd5615e711f600f300d1 (patch)
tree690a8708205835389f3b4ec4d97acf6753e4c242
parent478e107390f25a180a26ee3174a848c9dcc51c34 (diff)
(diskfs_create_node): Validate mode change before making it.
-rw-r--r--libdiskfs/node-create.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libdiskfs/node-create.c b/libdiskfs/node-create.c
index 6905b5e2..b81cbcf3 100644
--- a/libdiskfs/node-create.c
+++ b/libdiskfs/node-create.c
@@ -57,6 +57,7 @@ diskfs_create_node (struct node *dir,
if (err)
goto change_err;
np->dn_stat.st_uid = cred->uids[0];
+ }
else
{
err = diskfs_validate_owner_change (np, dir->dn_stat.st_uid);
@@ -75,9 +76,12 @@ diskfs_create_node (struct node *dir,
np->dn_stat.st_gid = dir->dn_stat.st_gid;
mode &= ~S_ISGID;
}
-
+
np->dn_stat.st_rdev = 0;
np->dn_stat.st_nlink = !!name;
+ err = diskfs_validate_mode_change (np, mode);
+ if (err)
+ goto change_err;
np->dn_stat.st_mode = mode;
np->dn_stat.st_blocks = 0;