Fix `fd may be used uninitialized in this function` warning