Browse Source

z/OS suport: Initialize stuff

Fixed the segfaults on z/OS and it's importing pubkeys again
master
David Lanzendörfer 11 months ago
parent
commit
52823d04a2
1 changed files with 9 additions and 10 deletions
  1. +9
    -10
      src/reader.c

+ 9
- 10
src/reader.c View File

@ -154,10 +154,11 @@ __RCSID("$NetBSD$");
char A(char c)
{
char ret = c;
#if defined(NETPGP_EBCDIC)
__e2a_l(&c,1);
__e2a_l(&ret,1);
#endif
return c;
return ret;
}
/* get a pass phrase from the user */
@ -496,7 +497,6 @@ read_and_eat_whitespace(pgp_stream_t *stream, dearmour_t *dearmour,
unsigned skip)
{
int c;
do {
c = read_char(stream, dearmour, errors, readinfo, cbinfo, skip);
} while (isspace(c)&&c!='\n');
@ -506,8 +506,8 @@ read_and_eat_whitespace(pgp_stream_t *stream, dearmour_t *dearmour,
static void
flush(dearmour_t *dearmour, pgp_cbdata_t *cbinfo)
{
pgp_packet_t content;
if (dearmour->unarmoredc > 0) {
pgp_packet_t content;
if ( dearmour->unarmoredc > 0) {
content.u.unarmoured_text.data = dearmour->unarmoured;
content.u.unarmoured_text.length = (unsigned)dearmour->unarmoredc;
CALLBACK(PGP_PTAG_CT_UNARMOURED_TEXT, cbinfo, &content);
@ -523,7 +523,6 @@ unarmoured_read_char(pgp_stream_t *stream, dearmour_t *dearmour,
unsigned skip)
{
int c;
do {
c = read_char(stream, dearmour, errors, readinfo, cbinfo, 0);
if (c < 0) {
@ -1307,6 +1306,7 @@ pgp_reader_push_dearmour(pgp_stream_t *parse_info)
{
dearmour_t *dearmour;
pgp_headers_t headers;
memset(&headers, 0, sizeof(pgp_headers_t));
if ((dearmour = malloc(sizeof(*dearmour))) == NULL) {
(void) fprintf(stderr, "pgp_reader_push_dearmour: bad alloc\n");
} else {
@ -1323,7 +1323,7 @@ pgp_reader_push_dearmour(pgp_stream_t *parse_info)
dearmour->buffered=1;
dearmour->unarmoredc=0;
dearmour->lastseen=0;
dearmour->headers=headers;
dearmour->headers=headers;
pgp_reader_push(parse_info, armoured_data_reader, armoured_data_destroyer, dearmour);
}
}
@ -2315,9 +2315,9 @@ mmap_destroyer(pgp_reader_t *readinfo)
}
#ifdef MAP_FILE
#define MMAP_MAP_FILE_FLAGS (MAP_PRIVATE | MAP_FILE)
#define MMAP_MAP_FILE_FLAGS ( MAP_PRIVATE | MAP_FILE )
#else
#define MMAP_MAP_FILE_FLAGS (MAP_PRIVATE)
#define MMAP_MAP_FILE_FLAGS ( MAP_SHARED )
#endif
/* set up the file to use mmap-ed memory if available, file IO otherwise */
@ -2336,7 +2336,6 @@ pgp_reader_set_mmap(pgp_stream_t *stream, int fd)
mem->fd = fd;
mem->mem = mmap(NULL, (size_t)st.st_size, PROT_READ, MMAP_MAP_FILE_FLAGS, fd, 0);
if (mem->mem == MAP_FAILED) {
printf("Error setting reader\n");
pgp_reader_set(stream, fd_reader, reader_fd_destroyer, mem);
} else {
pgp_reader_set(stream, mmap_reader, mmap_destroyer, mem);


Loading…
Cancel
Save