[PATCH] dup fd error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



set errorp in dup_fd, it will be used in sys_unshare also.

Signed-off-by: Prasanna Meda

--- a/kernel/fork.c	2006-04-17 22:38:09.000000000 +0530
+++ b/kernel/fork.c	2006-04-18 00:38:37.000000000 +0530
@@ -629,6 +629,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)
 {
@@ -637,6 +638,7 @@ static struct files_struct *dup_fd(struc
 	int open_files, size, i, expand;
 	struct fdtable *old_fdt, *new_fdt;
 
+	*errorp = -ENOMEM;
 	newf = alloc_files();
 	if (!newf)
 		goto out;
@@ -750,7 +752,6 @@ static int copy_files(unsigned long clon
 	 * break this.
 	 */
 	tsk->files = NULL;
-	error = -ENOMEM;
 	newf = dup_fd(oldf, &error);
 	if (!newf)
 		goto out;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux