It currently returned -1 on failure and 1 on success. The API is intended to return -1 on failure and 0 on success, so fix that.