[Yaffs] [PATCH YAFFS2 15/15] fix-mknod-uid-gid
Luc Van Oostenryck
luc.vanoostenryck at looxix.net
Thu Jul 28 00:00:32 BST 2005
This patch set correctly the uid and the gid of a newly created file.
It should solve the problem of Frank Lehmann (http://lists.aleph1.co.uk/pipermail/yaffs/2005q2/001178.html),
-- Luc Van Oostenryck
-------------- next part --------------
diff --git a/fs/yaffs2/yaffs_fs.c b/fs/yaffs2/yaffs_fs.c
--- a/fs/yaffs2/yaffs_fs.c
+++ b/fs/yaffs2/yaffs_fs.c
@@ -912,6 +912,8 @@ static int yaffs_mknod(struct inode *dir
yaffs_Object *parent = yaffs_InodeToObject(dir);
int error = -ENOSPC;
+ uid_t uid = current->fsuid;
+ gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
if(parent)
{
@@ -937,18 +939,18 @@ static int yaffs_mknod(struct inode *dir
// Special (socket, fifo, device...)
T(YAFFS_TRACE_OS,(KERN_DEBUG"yaffs_mknod: making special\n"));
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
- obj = yaffs_MknodSpecial(parent,dentry->d_name.name,mode,current->uid, current->gid,old_encode_dev(rdev));
+ obj = yaffs_MknodSpecial(parent,dentry->d_name.name,mode,uid, gid,old_encode_dev(rdev));
#else
- obj = yaffs_MknodSpecial(parent,dentry->d_name.name,mode,current->uid, current->gid,rdev);
+ obj = yaffs_MknodSpecial(parent,dentry->d_name.name,mode,uid, gid,rdev);
#endif
break;
case S_IFREG: // file
T(YAFFS_TRACE_OS,(KERN_DEBUG"yaffs_mknod: making file\n"));
- obj = yaffs_MknodFile(parent,dentry->d_name.name,mode,current->uid, current->gid);
+ obj = yaffs_MknodFile(parent,dentry->d_name.name,mode,uid, gid);
break;
case S_IFDIR: // directory
T(YAFFS_TRACE_OS,(KERN_DEBUG"yaffs_mknod: making directory\n"));
- obj = yaffs_MknodDirectory(parent,dentry->d_name.name,mode,current->uid, current->gid);
+ obj = yaffs_MknodDirectory(parent,dentry->d_name.name,mode,uid, gid);
break;
case S_IFLNK: // symlink
T(YAFFS_TRACE_OS,(KERN_DEBUG"yaffs_mknod: making file\n"));
@@ -1084,13 +1086,15 @@ static int yaffs_symlink(struct inode *
{
yaffs_Object *obj;
yaffs_Device *dev;
+ uid_t uid = current->fsuid;
+ gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
T(YAFFS_TRACE_OS,(KERN_DEBUG"yaffs_symlink\n"));
dev = yaffs_InodeToObject(dir)->myDev;
yaffs_GrossLock(dev);
obj = yaffs_MknodSymLink(yaffs_InodeToObject(dir), dentry->d_name.name,
- S_IFLNK | S_IRWXUGO, current->uid, current->gid,
+ S_IFLNK | S_IRWXUGO, uid, gid,
symname);
yaffs_GrossUnlock(dev);
More information about the yaffs
mailing list