patch-2.3.40 linux/fs/namei.c
Next file: linux/fs/ncpfs/inode.c
Previous file: linux/fs/lockd/xdr.c
Back to the patch index
Back to the overall index
- Lines: 196
- Date:
Wed Jan 12 11:51:49 2000
- Orig file:
v2.3.39/linux/fs/namei.c
- Orig date:
Tue Jan 4 13:57:18 2000
diff -u --recursive --new-file v2.3.39/linux/fs/namei.c linux/fs/namei.c
@@ -780,16 +780,14 @@
char * tmp;
struct dentry * dentry;
- lock_kernel();
- error = -EPERM;
if (S_ISDIR(mode) || (!S_ISFIFO(mode) && !capable(CAP_MKNOD)))
- goto out;
+ return -EPERM;
tmp = getname(filename);
- error = PTR_ERR(tmp);
if (IS_ERR(tmp))
- goto out;
+ return PTR_ERR(tmp);
error = -EINVAL;
+ lock_kernel();
switch (mode & S_IFMT) {
case 0:
mode |= S_IFREG; /* fallthrough */
@@ -815,10 +813,9 @@
}
break;
}
+ unlock_kernel();
putname(tmp);
-out:
- unlock_kernel();
return error;
}
@@ -870,14 +867,14 @@
int error;
char * tmp;
- lock_kernel();
tmp = getname(pathname);
- error = PTR_ERR(tmp);
- if (!IS_ERR(tmp)) {
- error = do_mkdir(tmp,mode);
- putname(tmp);
- }
+ if(IS_ERR(tmp))
+ return PTR_ERR(tmp);
+ lock_kernel();
+ error = do_mkdir(tmp,mode);
unlock_kernel();
+ putname(tmp);
+
return error;
}
@@ -965,14 +962,15 @@
int error;
char * tmp;
- lock_kernel();
tmp = getname(pathname);
- error = PTR_ERR(tmp);
- if (!IS_ERR(tmp)) {
- error = do_rmdir(tmp);
- putname(tmp);
- }
+ if(IS_ERR(tmp))
+ return PTR_ERR(tmp);
+ lock_kernel();
+ error = do_rmdir(tmp);
unlock_kernel();
+
+ putname(tmp);
+
return error;
}
@@ -1018,14 +1016,14 @@
int error;
char * tmp;
- lock_kernel();
tmp = getname(pathname);
- error = PTR_ERR(tmp);
- if (!IS_ERR(tmp)) {
- error = do_unlink(tmp);
- putname(tmp);
- }
+ if(IS_ERR(tmp))
+ return PTR_ERR(tmp);
+ lock_kernel();
+ error = do_unlink(tmp);
unlock_kernel();
+ putname(tmp);
+
return error;
}
@@ -1068,21 +1066,20 @@
{
int error;
char * from;
+ char * to;
- lock_kernel();
from = getname(oldname);
- error = PTR_ERR(from);
- if (!IS_ERR(from)) {
- char * to;
- to = getname(newname);
- error = PTR_ERR(to);
- if (!IS_ERR(to)) {
- error = do_symlink(from,to);
- putname(to);
- }
- putname(from);
+ if(IS_ERR(from))
+ return PTR_ERR(from);
+ to = getname(newname);
+ error = PTR_ERR(to);
+ if (!IS_ERR(to)) {
+ lock_kernel();
+ error = do_symlink(from,to);
+ unlock_kernel();
+ putname(to);
}
- unlock_kernel();
+ putname(from);
return error;
}
@@ -1156,21 +1153,21 @@
{
int error;
char * from;
+ char * to;
- lock_kernel();
from = getname(oldname);
- error = PTR_ERR(from);
- if (!IS_ERR(from)) {
- char * to;
- to = getname(newname);
- error = PTR_ERR(to);
- if (!IS_ERR(to)) {
- error = do_link(from,to);
- putname(to);
- }
- putname(from);
+ if(IS_ERR(from))
+ return PTR_ERR(from);
+ to = getname(newname);
+ error = PTR_ERR(to);
+ if (!IS_ERR(to)) {
+ lock_kernel();
+ error = do_link(from,to);
+ unlock_kernel();
+ putname(to);
}
- unlock_kernel();
+ putname(from);
+
return error;
}
@@ -1327,21 +1324,20 @@
{
int error;
char * from;
+ char * to;
- lock_kernel();
from = getname(oldname);
- error = PTR_ERR(from);
- if (!IS_ERR(from)) {
- char * to;
- to = getname(newname);
- error = PTR_ERR(to);
- if (!IS_ERR(to)) {
- error = do_rename(from,to);
- putname(to);
- }
- putname(from);
+ if(IS_ERR(from))
+ return PTR_ERR(from);
+ to = getname(newname);
+ error = PTR_ERR(to);
+ if (!IS_ERR(to)) {
+ lock_kernel();
+ error = do_rename(from,to);
+ unlock_kernel();
+ putname(to);
}
- unlock_kernel();
+ putname(from);
return error;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)