patch-2.4.7 linux/fs/sysv/namei.c
Next file: linux/include/asm-alpha/atomic.h
Previous file: linux/fs/sysv/inode.c
Back to the patch index
Back to the overall index
- Lines: 69
- Date:
Tue Jul 17 18:53:55 2001
- Orig file:
v2.4.6/linux/fs/sysv/namei.c
- Orig date:
Tue Jul 3 17:08:21 2001
diff -u --recursive --new-file v2.4.6/linux/fs/sysv/namei.c linux/fs/sysv/namei.c
@@ -86,11 +86,14 @@
static int sysv_mknod(struct inode * dir, struct dentry * dentry, int mode, int rdev)
{
struct inode * inode = sysv_new_inode(dir, mode);
- if (!inode)
- return -ENOSPC;
- sysv_set_inode(inode, rdev);
- mark_inode_dirty(inode);
- return add_nondir(dentry, inode);
+ int err = PTR_ERR(inode);
+
+ if (!IS_ERR(inode)) {
+ sysv_set_inode(inode, rdev);
+ mark_inode_dirty(inode);
+ err = add_nondir(dentry, inode);
+ }
+ return err;
}
static int sysv_create(struct inode * dir, struct dentry * dentry, int mode)
@@ -108,16 +111,17 @@
if (l > dir->i_sb->s_blocksize)
goto out;
- err = -ENOSPC;
inode = sysv_new_inode(dir, S_IFLNK|0777);
- if (!inode)
+ err = PTR_ERR(inode);
+ if (IS_ERR(inode))
goto out;
-
+
sysv_set_inode(inode, 0);
err = block_symlink(inode, symname, l);
if (err)
goto out_fail;
+ mark_inode_dirty(inode);
err = add_nondir(dentry, inode);
out:
return err;
@@ -153,16 +157,13 @@
if (dir->i_nlink >= dir->i_sb->sv_link_max)
goto out;
-
inc_count(dir);
- if (dir->i_mode & S_ISGID)
- mode |= S_ISGID;
-
- err = -ENOSPC;
inode = sysv_new_inode(dir, S_IFDIR|mode);
- if (!inode)
+ err = PTR_ERR(inode);
+ if (IS_ERR(inode))
goto out_dir;
+
sysv_set_inode(inode, 0);
inc_count(inode);
@@ -217,6 +218,7 @@
if (sysv_empty_dir(inode)) {
err = sysv_unlink(dir, dentry);
if (!err) {
+ inode->i_size = 0;
dec_count(inode);
dec_count(dir);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)