lib/notify: fix checks in spdk_notify_type_register

Adjusting error logs, by the way.

Change-Id: I84ec84e550d9bc7249e0af423faa0ab81cf1c892
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453142
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
wuzhouhui 2019-05-05 17:58:14 +08:00 committed by Jim Harris
parent 0560976d51
commit 8b3533f502

View File

@ -62,9 +62,8 @@ spdk_notify_type_register(const char *type)
if (!type) {
SPDK_ERRLOG("Invalid notification type %p\n", type);
return NULL;
} else if (!type || strlen(type) >= SPDK_NOTIFY_MAX_NAME_SIZE) {
SPDK_ERRLOG("Invalid notification type (add: %p, name: %s)\n", type,
type ? type : "(null)");
} else if (!type[0] || strlen(type) >= SPDK_NOTIFY_MAX_NAME_SIZE) {
SPDK_ERRLOG("Notification type '%s' too short or too long\n", type);
return NULL;
}