Skip to content
Snippets Groups Projects
Commit 49d858ac authored by Fredrik Thulin's avatar Fredrik Thulin
Browse files

gck_rpc_layer_initialize: Improve error reporting.

parent 62517880
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment