diff --git a/gck-rpc-dispatch.c b/gck-rpc-dispatch.c index da802c133a013718e634c58d145467389e014fca..5ed7979e0b4126dd840187c2f0fe02daaaba5b1c 100644 --- a/gck-rpc-dispatch.c +++ b/gck-rpc-dispatch.c @@ -2298,15 +2298,13 @@ int gck_rpc_layer_initialize(const char *prefix, CK_FUNCTION_LIST_PTR module) const char *ip; ip = strdup(prefix + 6); - if (ip) - p = strchr(ip, ':'); - - if (!ip) { - gck_rpc_warn("invalid syntax for pkcs11 socket : %s", - prefix); + if (ip == NULL) { + gck_rpc_warn("out of memory"); return -1; } + p = strchr(ip, ':'); + if (p) { *p = '\0'; port = strtol(p + 1, NULL, 0); @@ -2323,7 +2321,7 @@ int gck_rpc_layer_initialize(const char *prefix, CK_FUNCTION_LIST_PTR module) if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof (one)) == -1) { - gck_rpc_warn("couldn't create set pkcs11 " + gck_rpc_warn("couldn't set pkcs11 " "socket options : %s", strerror (errno)); return -1; } @@ -2331,7 +2329,7 @@ int gck_rpc_layer_initialize(const char *prefix, CK_FUNCTION_LIST_PTR module) if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) == -1) { gck_rpc_warn - ("couldn't create set pkcs11 socket options : %s", + ("couldn't set pkcs11 socket options : %s", strerror(errno)); return -1; }