]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/init.c
A little cleanup of last 2 commits
[openldap] / libraries / libldap / init.c
index e7d0648a1f7448cf181791ca519a056d7a8d87f8..093cedf32f4f47bbeb537e9a352bb0bcfc981c68 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 #include "portable.h"
@@ -267,7 +267,7 @@ static void openldap_ldap_init_w_userconf(const char *file)
                Debug(LDAP_DEBUG_TRACE, "ldap_init: HOME env is %s\n",
                      home, 0, 0);
 #endif
-               path = LDAP_MALLOC(strlen(home) + strlen(file) + 3);
+               path = LDAP_MALLOC(strlen(home) + strlen(file) + sizeof( LDAP_DIRSEP "."));
        } else {
 #ifdef NEW_LOGGING
        LDAP_LOG ( CONFIG, ARGS, "openldap_init_w_userconf: HOME env is NULL\n",
@@ -282,11 +282,11 @@ static void openldap_ldap_init_w_userconf(const char *file)
                /* we assume UNIX path syntax is used... */
 
                /* try ~/file */
-               sprintf(path, "%s%s%s", home, LDAP_DIRSEP, file);
+               sprintf(path, "%s" LDAP_DIRSEP "%s", home, file);
                openldap_ldap_init_w_conf(path, 1);
 
                /* try ~/.file */
-               sprintf(path, "%s%s.%s", home, LDAP_DIRSEP, file);
+               sprintf(path, "%s" LDAP_DIRSEP ".%s", home, file);
                openldap_ldap_init_w_conf(path, 1);
        }
 
@@ -483,6 +483,8 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
 
        ldap_int_error_init();
 
+       ldap_int_utils_init();
+
 #ifdef HAVE_WINSOCK2
 {      WORD wVersionRequested;
        WSADATA wsaData;
@@ -521,8 +523,6 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
        || defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
        ldap_int_hostname = ldap_pvt_get_fqdn( ldap_int_hostname );
 #endif
-       ldap_int_utils_init();
-
        if ( ldap_int_tblsize == 0 )
                ldap_int_ip_init();