<div dir="ltr">Nothing. You're just wasting resources (file descriptors) and making your code a bit harder to understand and maintain.<div><br></div><div style>Note that for pipe(), you can use both fds at both ends of the pipe, but it's very easy to get into a race condition.Better to open a pair of pipes, one for each direction (of course, you now need to worry about deadlocks...).</div>
<div style><br></div><div style>Rony</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 4, 2013 at 2:24 PM, Erez D <span dir="ltr"><<a href="mailto:erez0001@gmail.com" target="_blank">erez0001@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>hello<br><br></div>using the usual pipe()+fork()+dup()+close() to fork a child process and pipe data from and to it,<br>
<br></div><div>I know both the child and parent must close the unused fds.<br>
</div></div><br>why ?<br></div>what if i don't close the unsed fds ?<br><br><br></div>thanks,<br></div>erez.<br><div><div><div><div><br></div></div></div></div></div>
<br>_______________________________________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" target="_blank">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Ubi dubium, ibi libertas (where there is doubt, there is freedom)<br>
</div>