]> git.sur5r.net Git - openldap/commitdiff
for slurpd's replica directory (slurpd.status, and rej file) use a subdir of what...
authorBen Collins <bcollins@openldap.org>
Mon, 24 Apr 2000 17:03:45 +0000 (17:03 +0000)
committerBen Collins <bcollins@openldap.org>
Mon, 24 Apr 2000 17:03:45 +0000 (17:03 +0000)
servers/slurpd/args.c
servers/slurpd/globals.c
servers/slurpd/main.c

index 6fd96c9dd915b10ae18d9bc1f2a66177e78b80f0..ff28e0bb4f215ef6c9460bad6b1a5f05a04eb134 100644 (file)
@@ -111,7 +111,8 @@ doargs(
            rflag++;
            break;
        case 't':       /* dir to use for our copies of replogs */
-           g->slurpd_rdir = strdup( optarg );
+           g->slurpd_rdir = (char *)malloc (strlen(optarg) + strlen("/replica") + 1);
+           sprintf(g->slurpd_rdir, "%s/replica", optarg);
            break;
        case 'k':       /* name of kerberos srvtab file */
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
index ec913dfd06122841462a0a6fbbfc860e49a1f439..9c7911ffd5aa73cab0eb0e0f57dd25ca5e9fdfb8 100644 (file)
@@ -50,7 +50,7 @@ init_globals( void )
     g->slurpd_shutdown = 0;
     g->num_replicas = 0;
     g->replicas = NULL;
-    g->slurpd_rdir = DEFAULT_SLURPD_REPLICA_DIR;
+    g->slurpd_rdir = DEFAULT_SLURPD_REPLICA_DIR "/replica";
     strcpy( g->slurpd_status_file, DEFAULT_SLURPD_STATUS_FILE );
     g->slapd_replogfile[ 0 ] = '\0';
     g->slurpd_replogfile[ 0 ] = '\0';
index 2aa86e75c9bb3789fd0c5d5a7198c741bfd46399..ab029f26c2b8f2aeb9160bc2680d22f92303f9a2 100644 (file)
@@ -70,6 +70,14 @@ main(
        exit( EXIT_FAILURE );
     }
 
+    /* 
+     * Make sure our directory exists
+     */
+    if ( mkdir(sglob->slurpd_rdir, 0755) == -1 && errno != EEXIST) {
+       perror(sglob->slurpd_rdir);
+       exit( 1 );
+    }
+
     /*
      * Get any saved state information off the disk.
      */