Set errno and return -1