just use fprintf, it's not that bad
remove unnecessary errno variables