回答編集履歴

1

補足

2021/07/20 15:51

投稿

otn
otn

スコア84555

test CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  子プロセスが`exit`する際に、`exit`の内部で`fflush(stdin)`相当が行われますが、それによる影響のようです。
4
4
 
5
+ 親プロセス側で、`ftell(stdin)`を実行するとエラーが返ります。
6
+
5
7
 
6
8
 
7
9
  子プロセスで`exit`する前に、`fclose(stdin);`等を実行すれば良いかと思います。
10
+
11
+ `fflush(stdin);fclose(stdin);exit(1);`で、現象が出る。
12
+
13
+ `fclose(stdin);exit(1);`で、現象が出ない。