Having trouble with fork(), pipe(), dup2() and exec() in C

后端 未结 6 651
时光取名叫无心
时光取名叫无心 2020-12-01 03:44

Here\'s my code:

#include 
#include 
#include 
#include 
#include 

#         


        
6条回答
  •  失恋的感觉
    2020-12-01 04:43

    the file descriptors from the pipe are reference counted, and incremented with each fork. for every fork, you have to issue a close on both descriptors in order to reduce the reference count to zero and allow the pipe to close. I'm guessing.

提交回复
热议问题