daemon should check for failures and return -1