freopen stdout
This should ensure fd 1 becomes the new file too. There may be a race condition here. I'm not convinced it is fail safe, if it fails, stdout should remain usable, but it looks like we just trashed it.
This should ensure fd 1 becomes the new file too. There may be a race condition here. I'm not convinced it is fail safe, if it fails, stdout should remain usable, but it looks like we just trashed it.