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
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';
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.
*/