diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/keydb.c | 12 | ||||
-rw-r--r-- | g10/plaintext.c | 39 |
2 files changed, 6 insertions, 45 deletions
diff --git a/g10/keydb.c b/g10/keydb.c index 2db231136..3938d7e16 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -418,22 +418,22 @@ rt_from_file (const char *filename, int *r_found, int *r_openpgp) { u32 magic; unsigned char verbuf[4]; - FILE *fp; + estream_t fp; KeydbResourceType rt = KEYDB_RESOURCE_TYPE_NONE; *r_found = *r_openpgp = 0; - fp = fopen (filename, "rb"); + fp = es_fopen (filename, "rb"); if (fp) { *r_found = 1; - if (fread (&magic, 4, 1, fp) == 1 ) + if (es_fread (&magic, 4, 1, fp) == 1 ) { if (magic == 0x13579ace || magic == 0xce9a5713) ; /* GDBM magic - not anymore supported. */ - else if (fread (&verbuf, 4, 1, fp) == 1 + else if (es_fread (&verbuf, 4, 1, fp) == 1 && verbuf[0] == 1 - && fread (&magic, 4, 1, fp) == 1 + && es_fread (&magic, 4, 1, fp) == 1 && !memcmp (&magic, "KBXf", 4)) { if ((verbuf[3] & 0x02)) @@ -446,7 +446,7 @@ rt_from_file (const char *filename, int *r_found, int *r_openpgp) else /* Maybe empty: assume keyring. */ rt = KEYDB_RESOURCE_TYPE_KEYRING; - fclose (fp); + es_fclose (fp); } return rt; diff --git a/g10/plaintext.c b/g10/plaintext.c index f9e0a4296..3e169d93f 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -146,7 +146,6 @@ get_output_file (const byte *embedded_name, int embedded_namelen, } } -#ifndef __riscos__ if (opt.outfp && is_secured_file (es_fileno (opt.outfp))) { err = gpg_error (GPG_ERR_EPERM); @@ -168,44 +167,6 @@ get_output_file (const byte *embedded_name, int embedded_namelen, log_error (_("error creating '%s': %s\n"), fname, gpg_strerror (err)); goto leave; } -#else /* __riscos__ */ - /* If no output filename was given, i.e. we constructed it, convert - all '.' in fname to '/' but not vice versa as we don't create - directories! */ - if (!opt.outfile) - for (c = 0; fname[c]; ++c) - if (fname[c] == '.') - fname[c] = '/'; - - if (fp || nooutput) - ; - else - { - /* Note: riscos stuff is not expected to work anymore. If we - want to port it again to riscos we should do most of the suff - in estream. FIXME: Consider to remove all riscos special - cases. */ - fp = fopen (fname, "wb"); - if (!fp) - { - log_error (_("error creating '%s': %s\n"), fname, gpg_strerror (err)); - err = GPG_ERR_CREATE_FILE; - if (errno == 106) - log_info ("Do output file and input file have the same name?\n"); - goto leave; - } - - /* If there's a ,xxx extension in the embedded filename, - use that, else check whether the user input (in fname) - has a ,xxx appended, then use that in preference */ - if ((c = riscos_get_filetype_from_string (embedded_name, - embedded_namelen)) != -1) - filetype = c; - if ((c = riscos_get_filetype_from_string (fname, strlen (fname))) != -1) - filetype = c; - riscos_set_filetype_by_number (fname, filetype); - } -#endif /* __riscos__ */ leave: if (err) |