]> code.citadel.org Git - citadel.git/blobdiff - citadel/utils/ctdlload.c
ctdldump/ctdlload: more testing
[citadel.git] / citadel / utils / ctdlload.c
index cf651a98fcf84568eea304d630abb27a41414c13..5c660dab7e6b2d0d1f5d198b6bf438cc266f3db4 100644 (file)
@@ -466,8 +466,11 @@ int import_dir(char *line, DBT *out_key, DBT *out_data) {
 
        out_key->size = strlen(dirkey);
        out_key->data = reallok(NULL, out_key->size);
+       memcpy(out_key->data, dirkey, strlen(dirkey));
+
        out_data->size = strlen(username) + 1;
        out_data->data = strdup(username);
+
        return(1);
 }
 
@@ -847,12 +850,19 @@ int main(int argc, char **argv) {
                }
        }
 
+       if (dst_dir == NULL) {
+               fprintf(stderr, "ctdlload: no destination directory was specified.\n");
+               exit(1);
+       }
+
        if (confirmed == 1) {
                fprintf(stderr, "ctdlload: You have specified the [-y] flag, so processing will continue.\n");
        }
        else {
-               fprintf(stderr, "ctdlload: Please read [ https://www.citadel.org/dump-and-load.html ] to learn how to proceed.\n");
-               exit(0);
+               fprintf(stderr, "ctdlload: usage: ctdlload -y -h[data_dir] <[dump_file]\n");
+               fprintf(stderr, "          [data_dir] is your database directory, usually /usr/local/citadel/data\n");
+               fprintf(stderr, "          Please read [ https://www.citadel.org/dump-and-load.html ] to learn how to proceed.\n");
+               exit(1);
        }
 
        // Remove any database that is already in the target directory (yes, delete it, be careful)