fix assumption in fputs that fwrite returning 0 implies an error