Why does forking my process cause the file to be read infinitely

后端 未结 4 1306
小蘑菇
小蘑菇 2020-11-29 12:08

I\'ve boiled down my entire program to a short main that replicates the issue, so forgive me for it not making any sense.

input.txt is a text file that has a couple

4条回答
  •  借酒劲吻你
    2020-11-29 12:31

    Replace exit(0) with _exit(0), and all is fine. This is an old unix tradition, if you are using stdio, your forked image must use _exit(), not exit().

提交回复
热议问题