aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorPrasanna Meda <mlp@google.com>2006-06-23 05:05:23 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:43:04 -0400
commit6e6672604773b9bae44d88d38afdf0763c104b1c (patch)
treefa597c1b9d46d3f7ed6743f2230a0ac9813693a7 /kernel/fork.c
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/fork.c')
-rw-r--r--kernel/fork.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 195958a3a4d6..49adc0e8d47c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -625,6 +625,7 @@ out:
625/* 625/*
626 * Allocate a new files structure and copy contents from the 626 * Allocate a new files structure and copy contents from the
627 * passed in files structure. 627 * passed in files structure.
628 * errorp will be valid only when the returned files_struct is NULL.
628 */ 629 */
629static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) 630static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
630{ 631{
@@ -633,6 +634,7 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
633 int open_files, size, i, expand; 634 int open_files, size, i, expand;
634 struct fdtable *old_fdt, *new_fdt; 635 struct fdtable *old_fdt, *new_fdt;
635 636
637 *errorp = -ENOMEM;
636 newf = alloc_files(); 638 newf = alloc_files();
637 if (!newf) 639 if (!newf)
638 goto out; 640 goto out;
@@ -746,7 +748,6 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
746 * break this. 748 * break this.
747 */ 749 */
748 tsk->files = NULL; 750 tsk->files = NULL;
749 error = -ENOMEM;
750 newf = dup_fd(oldf, &error); 751 newf = dup_fd(oldf, &error);
751 if (!newf) 752 if (!newf)
752 goto out; 753 goto out;