Added clicon_handle as parameter to all functions to get better error message

This commit is contained in:
Olof hagsand 2019-11-30 22:19:23 +01:00
parent 6fc8a69dff
commit 69b27f3280
7 changed files with 35 additions and 32 deletions

View file

@ -95,10 +95,14 @@ main(int argc,
char *family = "UNIX";
int ret;
cbuf *cb = cbuf_new();
clicon_handle h;
/* In the startup, logs to stderr & debug flag set later */
clicon_log_init(__FILE__, LOG_INFO, CLICON_LOG_STDERR);
if ((h = clicon_handle_init()) == NULL)
goto done;
optind = 1;
opterr = 0;
while ((c = getopt(argc, argv, "hD:s:f:Ja:")) != -1)
@ -161,11 +165,11 @@ main(int argc,
if ((msg = clicon_msg_encode(getpid(), "%s", cbuf_get(cb))) < 0)
goto done;
if (strcmp(family, "UNIX")==0){
if (clicon_rpc_connect_unix(msg, sockpath, &retdata, NULL) < 0)
if (clicon_rpc_connect_unix(h, msg, sockpath, &retdata, NULL) < 0)
goto done;
}
else
if (clicon_rpc_connect_inet(msg, sockpath, 4535, &retdata, NULL) < 0)
if (clicon_rpc_connect_inet(h, msg, sockpath, 4535, &retdata, NULL) < 0)
goto done;
fprintf(stdout, "%s\n", retdata);
retval = 0;