sockstat: fix core dump

The get_proto_type function is used before creating the Casper function.
This is why we have to distinguish when the Casper service is allocated or not.

Reported by:	olivier@
Tested by:	olivier@
This commit is contained in:
Mariusz Zaborski 2021-06-18 18:03:16 +02:00
parent 7bd295750b
commit bfb5947bb1

View File

@ -163,7 +163,10 @@ get_proto_type(const char *proto)
if (strlen(proto) == 0)
return (0);
pent = cap_getprotobyname(capnetdb, proto);
if (capnetdb != NULL)
pent = cap_getprotobyname(capnetdb, proto);
else
pent = getprotobyname(proto);
if (pent == NULL) {
warn("cap_getprotobyname");
return (-1);