Skip to content

Commit

Permalink
[PATCH] dup fd error fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Prasanna Meda authored and Linus Torvalds committed Jun 23, 2006
1 parent 538c590 commit 6e66726
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ static struct files_struct *alloc_files(void)
/*
* 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)
{
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6e66726

Please sign in to comment.