[Fedora-directory-commits] ldapserver/ldap/servers/slapd proto-slap.h, 1.14, 1.15 util.c, 1.8, 1.9

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Thu Jan 12 00:29:06 UTC 2006


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22527

Modified Files:
	proto-slap.h util.c 
Log Message:
[174774] Backup does not clear the backup directory prior to performing backup; Restore tries to restore all the fles from the backupdir
1) if the specified backup directory exists, rename it to <dir>.bak
2) support relative dir for the backup/restore dir, e.g., "bak2db bak/mybak" 



Index: proto-slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/proto-slap.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- proto-slap.h	10 Jan 2006 23:53:02 -0000	1.14
+++ proto-slap.h	12 Jan 2006 00:28:57 -0000	1.15
@@ -390,6 +390,7 @@
 int config_get_csnlogging();
 int is_abspath(const char *);
 char* rel2abspath( char * );
+char* rel2abspath_ext( char *, char * );
 
 /*
  * configdse.c


Index: util.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/util.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- util.c	10 Jan 2006 23:53:02 -0000	1.8
+++ util.c	12 Jan 2006 00:28:57 -0000	1.9
@@ -455,6 +455,12 @@
 char *
 rel2abspath( char *relpath )
 {
+    return rel2abspath_ext( relpath, NULL );
+}
+
+char *
+rel2abspath_ext( char *relpath, char *cwd )
+{
     char abspath[ MAXPATHLEN + 1 ];
 
 #if defined( _WIN32 )
@@ -480,11 +486,15 @@
     if ( relpath[ 0 ] == _CSEP ) {     /* absolute path */
         PR_snprintf(abspath, sizeof(abspath), "%s", relpath);
     } else {                        /* relative path */
-        if ( getcwd( abspath, MAXPATHLEN ) == NULL ) {
-            perror( "getcwd" );
-            LDAPDebug( LDAP_DEBUG_ANY, "Cannot determine current directory\n",
-                    0, 0, 0 );
-            exit( 1 );
+        if ( NULL == cwd ) {
+            if ( getcwd( abspath, MAXPATHLEN ) == NULL ) {
+                perror( "getcwd" );
+                LDAPDebug( LDAP_DEBUG_ANY, "Cannot determine current directory\n",
+                        0, 0, 0 );
+                exit( 1 );
+            }
+        } else {
+            PR_snprintf(abspath, sizeof(abspath), "%s", cwd);
         }
     
         if ( strlen( relpath ) + strlen( abspath ) + 1  > MAXPATHLEN ) {




More information about the Fedora-directory-commits mailing list