I've made a couple of minor changes to the fs/pipe patch posted
earlier. This patch fixes an error return code (was ENFILE instead of
-ENFILE) and tests the allocation of the dentry.
Regards,
Bill
--------------E77AC7ADA3C0AE2B15EE79A3
Content-Type: text/plain; charset=us-ascii; name="pipe_50-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="pipe_50-patch"
--- fs/pipe.c.old Tue Aug 12 07:45:37 1997
+++ fs/pipe.c Sat Aug 16 18:22:51 1997
@@ -399,7 +401,7 @@
/*
* Mark the inode dirty from the very beginning,
* that way it will never be moved to the dirty
- * list because "make_inode_dirty()" will think
+ * list because "mark_inode_dirty()" will think
* that it already _is_ on the dirty list.
*/
inode->i_state = 1 << I_DIRTY;
@@ -439,7 +441,7 @@
int error;
int i,j;
- error = ENFILE;
+ error = -ENFILE;
f1 = get_empty_filp();
if (!f1)
goto no_files;
@@ -462,7 +464,10 @@
goto close_f12_inode_i;
j = error;
+ error = -ENOMEM;
f1->f_dentry = f2->f_dentry = dget(d_alloc_root(inode, NULL));
+ if (!f1->f_dentry)
+ goto close_f12_inode_i_j;
/* read file */
f1->f_pos = f2->f_pos = 0;
@@ -480,6 +485,8 @@
fd[1] = j;
return 0;
+close_f12_inode_i_j:
+ put_unused_fd(j);
close_f12_inode_i:
put_unused_fd(i);
close_f12_inode:
--------------E77AC7ADA3C0AE2B15EE79A3--