From: Jeremy Harris Date: Sat, 16 Sep 2017 15:03:32 +0000 (+0100) Subject: tidying X-Git-Tag: exim-4_90_RC1~70 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/7845dbb347426b7f216007a1109c3fe7000e5bc0 tidying --- diff --git a/src/src/deliver.c b/src/src/deliver.c index a8012804d..c91f26e81 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -3291,11 +3291,9 @@ address_item *addrlist = p->addrlist; address_item *addr = p->addr; pid_t pid = p->pid; int fd = p->fd; -int required = PIPE_HEADER_SIZE; /* size including id, subid and length */ uschar *msg = p->msg; BOOL done = p->done; -BOOL finished = FALSE; /* Loop through all items, reading from the pipe when necessary. The pipe used to be non-blocking. But I do not see a reason for using non-blocking I/O @@ -3327,12 +3325,14 @@ while (!done) size_t required = PIPE_HEADER_SIZE; /* first the pipehaeder, later the data */ ssize_t got; - DEBUG(D_deliver) debug_printf("expect %d bytes (pipeheader) from transport process %d\n", required, pid); + DEBUG(D_deliver) debug_printf( + "expect %lu bytes (pipeheader) from tpt process %d\n", (ulong)required, pid); /* We require(!) all the PIPE_HEADER_SIZE bytes here, as we know, they're written in a timely manner, so waiting for the write shouldn't hurt a lot. If we get less, we can assume the subprocess do be done and do not expect any further information from it. */ + got = readn(fd, pipeheader, required); if (got != required) { @@ -3345,13 +3345,14 @@ while (!done) pipeheader[PIPE_HEADER_SIZE] = '\0'; DEBUG(D_deliver) - debug_printf("got %d bytes (pipeheader) from transport process %d\n", got, pid); + debug_printf("got %ld bytes (pipeheader) from transport process %d\n", + (long) got, pid); { /* If we can't decode the pipeheader, the subprocess seems to have a problem, we do not expect any furher information from it. */ char *endc; - required = strtol(pipeheader+2, &endc, 10); + required = Ustrtol(pipeheader+2, &endc, 10); if (*endc) { msg = string_sprintf("failed to read pipe " @@ -3363,7 +3364,8 @@ while (!done) } DEBUG(D_deliver) - debug_printf("expect %d bytes (pipedata) from transport process %d\n", required, pid); + debug_printf("expect %lu bytes (pipedata) from transport process %d\n", + (ulong)required, pid); /* Same as above, the transport process will write the bytes announced in a timely manner, so we can just wait for the bytes, getting less than expected @@ -4120,20 +4122,21 @@ if (size > BIG_BUFFER_SIZE-1) size = BIG_BUFFER_SIZE; } -/* Should we check that we do not write more than PIPE_BUF? What whould +/* Should we check that we do not write more than PIPE_BUF? What would that help? */ /* convert size to human readable string prepended by id and subid */ -if (PIPE_HEADER_SIZE != snprintf(CS pipe_header, PIPE_HEADER_SIZE+1, "%c%c%05d", id, subid, size)) +if (PIPE_HEADER_SIZE != snprintf(CS pipe_header, PIPE_HEADER_SIZE+1, "%c%c%05ld", + id, subid, (long)size)) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "header snprintf failed\n"); -DEBUG(D_deliver) debug_printf("header write id:%c,subid:%c,size:%d,final:%s\n", - id, subid, size, pipe_header); +DEBUG(D_deliver) debug_printf("header write id:%c,subid:%c,size:%ld,final:%s\n", + id, subid, (long)size, pipe_header); if ((ret = writev(fd, iov, 2)) != total_len) - log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Failed writing transport result to pipe (%d of %d bytes): %s", - ret, total_len, - ret == -1 ? strerror(errno) : "short write"); + log_write(0, LOG_MAIN|LOG_PANIC_DIE, + "Failed writing transport result to pipe (%ld of %ld bytes): %s", + (long)ret, (long)total_len, ret == -1 ? strerror(errno) : "short write"); } /************************************************* diff --git a/src/src/pdkim/pdkim.c b/src/src/pdkim/pdkim.c index f107a5948..695288162 100644 --- a/src/src/pdkim/pdkim.c +++ b/src/src/pdkim/pdkim.c @@ -699,7 +699,7 @@ if (sig->canon_body == PDKIM_CANON_RELAXED) if (!relaxed_data) { BOOL seen_wsp = FALSE; - const char *p; + const uschar * p; int q = 0; /* We want to be able to free this else we allocate @@ -875,7 +875,7 @@ for (sig = ctx->sig; sig; sig = sig->next) if (sig->canon_body == PDKIM_CANON_RELAXED) { /* Lines with just spaces need to be buffered too */ - char * cp = line.data; + uschar * cp = line.data; char c; while ((c = *cp)) diff --git a/src/src/pdkim/pdkim.h b/src/src/pdkim/pdkim.h index a350e6b7e..e82f26c05 100644 --- a/src/src/pdkim/pdkim.h +++ b/src/src/pdkim/pdkim.h @@ -262,7 +262,7 @@ typedef struct pdkim_ctx { uschar *cur_header; int cur_header_size; int cur_header_len; - char *linebuf; + uschar *linebuf; int linebuf_offset; int num_headers; pdkim_stringlist *headers; /* Raw headers for verification */ diff --git a/src/src/pdkim/signing.c b/src/src/pdkim/signing.c index 5f270bfd4..e8cb297ca 100644 --- a/src/src/pdkim/signing.c +++ b/src/src/pdkim/signing.c @@ -609,7 +609,7 @@ exim_dkim_signing_init(uschar * privkey_pem, es_ctx * sign_ctx) BIO * bp = BIO_new_mem_buf(privkey_pem, -1); if (!(sign_ctx->key = PEM_read_bio_PrivateKey(bp, NULL, NULL, NULL))) - return ERR_error_string(ERR_get_error(), NULL); + return US ERR_error_string(ERR_get_error(), NULL); return NULL; } @@ -656,7 +656,7 @@ if ( (ctx = EVP_PKEY_CTX_new(sign_ctx->key, NULL)) } if (ctx) EVP_PKEY_CTX_free(ctx); -return ERR_error_string(ERR_get_error(), NULL); +return US ERR_error_string(ERR_get_error(), NULL); } @@ -673,7 +673,7 @@ const uschar * s = pubkey_der->data; if ((verify_ctx->key = d2i_PUBKEY(NULL, &s, pubkey_der->len))) return NULL; -return ERR_error_string(ERR_get_error(), NULL); +return US ERR_error_string(ERR_get_error(), NULL); } @@ -706,7 +706,7 @@ if ( (ctx = EVP_PKEY_CTX_new(verify_ctx->key, NULL)) { EVP_PKEY_CTX_free(ctx); return NULL; } if (ctx) EVP_PKEY_CTX_free(ctx); -return ERR_error_string(ERR_get_error(), NULL); +return US ERR_error_string(ERR_get_error(), NULL); } diff --git a/src/src/utf8.c b/src/src/utf8.c index 255383051..4647785b9 100644 --- a/src/src/utf8.c +++ b/src/src/utf8.c @@ -68,7 +68,7 @@ any mixed-case annotation. This does not really matter for a domain. */ break; } } -if ((rc = idn2_lookup_u8(CCS s, &s1, IDN2_NFC_INPUT)) != IDN2_OK) +if ((rc = idn2_lookup_u8((const uint8_t *) s, &s1, IDN2_NFC_INPUT)) != IDN2_OK) { if (err) *err = US idn2_strerror(rc); return NULL;