From ec4634f91b36ebd7e7e3ee7666f44c930355714b Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 22 Jul 2023 10:48:44 -0400 Subject: [PATCH] ctdldump/ctdlload: fixed on Raspberry Pi, reintroduced to build --- citadel/Makefile | 2 +- citadel/utils/ctdldump.c | 4 +--- citadel/utils/ctdlload.c | 10 +++++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/citadel/Makefile b/citadel/Makefile index 836362f43..5f51c9c6d 100644 --- a/citadel/Makefile +++ b/citadel/Makefile @@ -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/*) diff --git a/citadel/utils/ctdldump.c b/citadel/utils/ctdldump.c index 9bfe93c59..a26914091 100644 --- a/citadel/utils/ctdldump.c +++ b/citadel/utils/ctdldump.c @@ -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)); diff --git a/citadel/utils/ctdlload.c b/citadel/utils/ctdlload.c index 80f00bd98..b8c4e2aec 100644 --- a/citadel/utils/ctdlload.c +++ b/citadel/utils/ctdlload.c @@ -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); -- 2.39.2