tsan: fix crash when user defines own fopen/fileno