ctdldump/ctdlload: fixed on Raspberry Pi, reintroduced to build
authorArt Cancro <ajc@citadel.org>
Sat, 22 Jul 2023 14:48:44 +0000 (10:48 -0400)
committerArt Cancro <ajc@citadel.org>
Sat, 22 Jul 2023 14:48:44 +0000 (10:48 -0400)
citadel/Makefile
citadel/utils/ctdldump.c
citadel/utils/ctdlload.c

index 836362f43ff9c390bea2c08269cd4c9d6147c324..5f51c9c6d054d999e58bb747cca73483eec71162 100644 (file)
@@ -10,7 +10,7 @@
 # config.mk is generated by ./configure
 include config.mk
 
-all := citserver setup sendcommand citmail chkpw chkpwd
+all := ctdldump ctdlload citserver setup sendcommand citmail chkpw chkpwd
 all: $(all)
 
 SRCDIRS := $(wildcard server server/modules/*)
index 9bfe93c59e11a8545da2498180542755c3edcbe0..a26914091bcfb830c9a475d0bb5e1eb594db1aa5 100644 (file)
@@ -33,7 +33,7 @@ void *reallok(void *ptr, size_t size) {
        void *p = realloc(ptr, size);
        if (!p) {
                fprintf(stderr, "realloc() failed to resize %p to %ld bytes, error: %m\n", ptr, size);
-               exit(1);
+               abort();
        }
        return p;
 }
@@ -43,8 +43,6 @@ void *reallok(void *ptr, size_t size) {
 char *b64out(void *data, size_t len) {
        static char *outbuf = NULL;
        static size_t outlen = 0;
-       int i;
-       char ch;
 
        if ((outbuf == NULL) || (outlen < (len * 2))) {
                outbuf = reallok(outbuf, (len * 2));
index 80f00bd9866165933bc35d4f07775311af931d4b..b8c4e2aec84b60811c987ada4030687312f6f16a 100644 (file)
@@ -34,7 +34,7 @@ void *reallok(void *ptr, size_t size) {
        void *p = realloc(ptr, size);
        if (!p) {
                fprintf(stderr, "realloc() failed to resize %p to %ld bytes, error: %m\n", ptr, size);
-               exit(1);
+               abort();
        }
        return p;
 }
@@ -351,8 +351,9 @@ int convert_floor(char *line, DBT *out_key, DBT *out_data) {
 // msglist|26|32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51|
 int convert_msglist(char *line, DBT *out_key, DBT *out_data) {
        long roomnum;
-       char *token;
+       char *token, *mtoken;
        char *p = line;
+       char *q = NULL;
        int num_msgs = 0;
        long *msglist = NULL;
 
@@ -362,8 +363,7 @@ int convert_msglist(char *line, DBT *out_key, DBT *out_data) {
                                roomnum = atol(token);
                                break;
                        case 2:
-                               char *q = token;
-                               char *mtoken;
+                               q = token;
                                for (int j=0; (mtoken = strsep(&q, ",")); ++j) {
                                        msglist = realloc(msglist, (num_msgs+1) * sizeof(long));
                                        msglist[num_msgs++] = atol(mtoken);
@@ -603,7 +603,7 @@ void ingest(DB_ENV *dst_dbenv) {
        static size_t line_alloc = 1;
        static char *line;
        static size_t line_len = 0;
-       char ch;
+       int ch;
 
        fprintf(stderr, "\033[7mtable\033[0m \033[7mgood_rows\033[0m \033[7mbad_rows\033[0m\n");
        line = reallok(NULL, line_alloc);