summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPrasanna Meda <mlp@google.com>2006-06-23 02:05:23 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 07:43:04 -0700
commit6e6672604773b9bae44d88d38afdf0763c104b1c (patch)
treefa597c1b9d46d3f7ed6743f2230a0ac9813693a7 /kernel
parent538c5902b81cc384e93ad3834b6d4a0b3fcb2285 (diff)
[PATCH] dup fd error fix
Set errorp in dup_fd, it will be used in sys_unshare also. Signed-off-by: Prasanna Meda <mlp@google.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 195958a3a4d..49adc0e8d47 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -625,6 +625,7 @@ out:
/*
* Allocate a new files structure and copy contents from the
* passed in files structure.
+ * errorp will be valid only when the returned files_struct is NULL.
*/
static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
{
@@ -633,6 +634,7 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
int open_files, size, i, expand;
struct fdtable *old_fdt, *new_fdt;
+ *errorp = -ENOMEM;
newf = alloc_files();
if (!newf)
goto out;
@@ -746,7 +748,6 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
* break this.
*/
tsk->files = NULL;
- error = -ENOMEM;
newf = dup_fd(oldf, &error);
if (!newf)
goto out;