Cdb apis return always...-1 irrespective of errors

cdb apis return always…-1 irrespective of errors as mentioned in user guide it should return specific error like
CONFD_ERR_MALLOC, CONFD_ERR_OS, CONFD_ERR_NOSESSION,
CONFD_ERR_BADPATH, CONFD_ERR_NOEXISTS, CONFD_ERR_ACCESS_DENIED

You need a little bit more effort to get the error that is set to confd_errno.

Example:

if (cdb_start_session(rsock, CDB_RUNNING) != CONFD_OK) {
        printf ("error: %s (%d): %s\n", confd_strerror(confd_errno), confd_errno, confd_lasterr());
}

See confd_lib_lib(3) man page section ERRORS.

Whenever CONFD_ERR is returned from any API function in libconfd it is possible to obtain additional information on the error through the symbol confd_errno. Additionally there may be an error text associated with the error. A call to the function
char *confd_lasterr(void);
returns a string which contains additional textual information on the error. Furthermore, the function
char *confd_strerror(int code);
returns a string which describes a particular error code. When one of the The following error codes are available: