apparently, rewriting to the same fd on exception is the thing to do...