Fix FD leak in pipe (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 23 Feb 2017 15:56:43 +0000 (10:56 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 2 Mar 2017 18:01:28 +0000 (13:01 -0500)
We weren't closing the dirfd.  You'd notice this after a lot of ssh
connections, since the pipes would build up.  They weren't closed and were
getting passed to dropbear's children.  After a dozen scps, if you looked
at the open files for a new ssh + shell connection, you'd see a dozen pipe
Qdirs.

Rebuild glibc, eventually.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/pipe2.c

index 26ebfe8..8089260 100644 (file)
@@ -40,6 +40,7 @@ int __pipe2(int pipedes[2], int flags)
        }
        pipedes[0] = dfd;
        pipedes[1] = d1fd;
+       close(dirfd);
        return 0;
 }
 weak_alias(__pipe2, pipe2)