libubus: fix writev_retry() function when writing large packets