[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: ldap_initialize vs ldap_init
On Tue, 1 Aug 2006, Mike Branda wrote:
> ldapconn = ldap_initialize(&ld, config->ldap_url);
> if(ldapconn == NULL) {
> 	ldap_perror(ldapconn, "ldap_initialize");
> 	return(-1);
> }
I tend to use:
if ((ret = ldap_initialize(&ld, uri)) != LDAP_SUCCESS)
{
	fprintf(stderr, "%s: Cannot initialise LDAP at '%s': %s\n",
		progname, uri, ldap_err2string(ret));
	exit(1);
}
Note the difference in testing the return code.
-- 
Dave Horsfall  DTM  VK2KFU  daveh@ci.com.au  Ph: +61 2 9552-5509 (d) -5500 (sw)
Corinthian Eng'ng P/L, Ste 54 Jones Bay Whf, 26-32 Pirrama Rd, Pyrmont 2009, AU