From: Prasanna Meda Date: Fri, 23 Jun 2006 09:05:23 +0000 (-0700) Subject: [PATCH] dup fd error fix X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6e6672604773b9bae44d88d38afdf0763c104b1c;p=linux-beck.git [PATCH] dup fd error fix Set errorp in dup_fd, it will be used in sys_unshare also. Signed-off-by: Prasanna Meda Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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: /* * 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;