The function ba_encode_ifname() returns the number of characters written on success, and -1 on error.