imagex_export(): Check errno correctly