diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 20 | ||||
-rw-r--r-- | g10/compress.c | 20 | ||||
-rw-r--r-- | g10/g10.c | 86 | ||||
-rw-r--r-- | g10/gpgv.c | 10 | ||||
-rw-r--r-- | g10/openfile.c | 28 | ||||
-rw-r--r-- | g10/options.h | 9 | ||||
-rw-r--r-- | g10/passphrase.c | 12 | ||||
-rw-r--r-- | g10/pkclist.c | 2 | ||||
-rw-r--r-- | g10/plaintext.c | 6 | ||||
-rw-r--r-- | g10/ringedit.c | 34 | ||||
-rw-r--r-- | g10/signal.c | 5 | ||||
-rw-r--r-- | g10/tdbio.c | 25 | ||||
-rw-r--r-- | g10/trustdb.c | 4 | ||||
-rw-r--r-- | g10/trustdb.h | 2 |
14 files changed, 209 insertions, 54 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 178e15b1c..7d583db9d 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,23 @@ +2001-08-20 Werner Koch <[email protected]> + + Applied patches from Stefan Bellon <[email protected]> to support + the RISCOS. Nearly all of these patches are identified by the + __riscos__ macro. + * compress.c: Added a couple of casts. + * g10.c [__riscos__]: Some patches and new options foo-file similar + to all foo-fd options. + * gpgv.c, openfile.c, ringedit.c, tdbio.c: Minor fixes. Mainly + replaced hardcoded path separators with EXTSEP_S like macros. + * passprase.c [__riscos__]: Disabled agent stuff + * trustdb.c (check_trust): Changed r_trustlevel to signed int to + avoid mismatch problems in pkclist.c + * pkclist.c (add_ownertrust): Ditto. + * plaintext.c (handle_plaintext) [__riscos__]: RPint a note when + file can't be created. + * options.h [__riscos__]: Use an extern unless included from the + main module. + * signal.c (got_fatal_signal) [__riscos__]: Close all files. + 2001-08-14 Werner Koch <[email protected]> * keygen.c (ask_algo): New arg r_usage. Allow for RSA keys. diff --git a/g10/compress.c b/g10/compress.c index a093b9efa..766fad9a5 100644 --- a/g10/compress.c +++ b/g10/compress.c @@ -73,7 +73,11 @@ do_compress( compress_filter_context_t *zfx, z_stream *zs, int flush, IOBUF a ) unsigned n; do { +#ifndef __riscos__ zs->next_out = zfx->outbuf; +#else /* __riscos__ */ + zs->next_out = (Bytef *) zfx->outbuf; +#endif /* __riscos__ */ zs->avail_out = zfx->outbufsize; if( DBG_FILTER ) log_debug("enter deflate: avail_in=%u, avail_out=%u, flush=%d\n", @@ -143,7 +147,11 @@ do_uncompress( compress_filter_context_t *zfx, z_stream *zs, if( zs->avail_in < zfx->inbufsize && refill ) { n = zs->avail_in; if( !n ) +#ifndef __riscos__ zs->next_in = zfx->inbuf; +#else /* __riscos__ */ + zs->next_in = (Bytef *) zfx->inbuf; +#endif /* __riscos__ */ count = zfx->inbufsize - n; nread = iobuf_read( a, zfx->inbuf + n, count ); if( nread == -1 ) nread = 0; @@ -201,7 +209,11 @@ compress_filter( void *opaque, int control, zfx->status = 1; } +#ifndef __riscos__ zs->next_out = buf; +#else /* __riscos__ */ + zs->next_out = (Bytef *) buf; +#endif /* __riscos__ */ zs->avail_out = size; zfx->outbufsize = size; /* needed only for calculation */ rc = do_uncompress( zfx, zs, a, ret_len ); @@ -226,7 +238,11 @@ compress_filter( void *opaque, int control, zfx->status = 2; } +#ifndef __riscos__ zs->next_in = buf; +#else /* __riscos__ */ + zs->next_in = (Bytef *) buf; +#endif /* __riscos__ */ zs->avail_in = size; rc = do_compress( zfx, zs, Z_NO_FLUSH, a ); } @@ -238,7 +254,11 @@ compress_filter( void *opaque, int control, m_free(zfx->outbuf); zfx->outbuf = NULL; } else if( zfx->status == 2 ) { +#ifndef __riscos__ zs->next_in = buf; +#else /* __riscos__ */ + zs->next_in = (Bytef *) buf; +#endif /* __riscos__ */ zs->avail_in = 0; do_compress( zfx, zs, Z_FINISH, a ); deflateEnd(zs); @@ -28,8 +28,11 @@ #ifdef HAVE_DOSISH_SYSTEM #include <fcntl.h> /* for setmode() */ #endif +#ifdef __riscos__ +#include <unixlib/local.h> +#endif /* __riscos__ */ - +#define INCLUDED_BY_MAIN_MODULE 1 #include "packet.h" #include "iobuf.h" #include "memory.h" @@ -125,6 +128,9 @@ enum cmd_and_opt_values { aNull = 0, oDebug, oDebugAll, oStatusFD, +#ifdef __riscos__ + oStatusFile, +#endif /* __riscos__ */ oNoComment, oNoVersion, oEmitVersion, @@ -138,7 +144,13 @@ enum cmd_and_opt_values { aNull = 0, oDigestAlgo, oCompressAlgo, oPasswdFD, +#ifdef __riscos__ + oPasswdFile, +#endif /* __riscos__ */ oCommandFD, +#ifdef __riscos__ + oCommandFile, +#endif /* __riscos__ */ oQuickRandom, oNoVerbose, oTrustDBName, @@ -179,6 +191,9 @@ enum cmd_and_opt_values { aNull = 0, oEncryptTo, oNoEncryptTo, oLoggerFD, +#ifdef __riscos__ + oLoggerFile, +#endif /* __riscos__ */ oUtf8Strings, oNoUtf8Strings, oDisableCipherAlgo, @@ -306,6 +321,9 @@ static ARGPARSE_OPTS opts[] = { { oDebug, "debug" ,4|16, "@"}, { oDebugAll, "debug-all" ,0, "@"}, { oStatusFD, "status-fd" ,1, N_("|FD|write status info to this FD") }, +#ifdef __riscos__ + { oStatusFile, "status-file" ,2, N_("|[file]|write status info to file") }, +#endif /* __riscos__ */ { oNoComment, "no-comment", 0, "@"}, { oCompletesNeeded, "completes-needed", 1, "@"}, { oMarginalsNeeded, "marginals-needed", 1, "@"}, @@ -344,7 +362,13 @@ static ARGPARSE_OPTS opts[] = { { aPipeMode, "pipemode", 0, "@" }, { oKOption, NULL, 0, "@"}, { oPasswdFD, "passphrase-fd",1, "@" }, +#ifdef __riscos__ + { oPasswdFile, "passphrase-file",2, "@" }, +#endif /* __riscos__ */ { oCommandFD, "command-fd",1, "@" }, +#ifdef __riscos__ + { oCommandFile, "command-file",2, "@" }, +#endif /* __riscos__ */ { oQuickRandom, "quick-random", 0, "@"}, { oNoVerbose, "no-verbose", 0, "@"}, { oTrustDBName, "trustdb-name", 2, "@" }, @@ -379,6 +403,9 @@ static ARGPARSE_OPTS opts[] = { { oLockMultiple, "lock-multiple", 0, "@" }, { oLockNever, "lock-never", 0, "@" }, { oLoggerFD, "logger-fd",1, "@" }, +#ifdef __riscos__ + { oLoggerFile, "logger-file",2, "@" }, +#endif /* __riscos__ */ { oUseEmbeddedFilename, "use-embedded-filename", 0, "@" }, { oUtf8Strings, "utf8-strings", 0, "@" }, { oNoUtf8Strings, "no-utf8-strings", 0, "@" }, @@ -454,7 +481,11 @@ strusage( int level ) break; case 31: p = "\nHome: "; break; +#ifndef __riscos__ case 32: p = opt.homedir; break; +#else /* __riscos__ */ + case 32: p = make_filename(opt.homedir, NULL); break; +#endif /* __riscos__ */ case 33: p = _("\nSupported algorithms:\n"); break; case 34: if( !ciphers ) @@ -627,6 +658,11 @@ main( int argc, char **argv ) #ifdef USE_SHM_COPROCESSING ulong requested_shm_size=0; #endif + #ifdef __riscos__ + /* set global RISC OS specific properties */ + __riscosify_control = __RISCOSIFY_NO_PROCESS; + opt.lock_once = 1; + #endif /* __riscos__ */ trap_unaligned(); secmem_set_flags( secmem_get_flags() | 2 ); /* suspend warnings */ @@ -822,10 +858,21 @@ main( int argc, char **argv ) case oStatusFD: set_status_fd( iobuf_translate_file_handle (pargs.r.ret_int, 1) ); break; +#ifdef __riscos__ + case oStatusFile: + set_status_fd( iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 1), 1) ); + break; +#endif /* __riscos__ */ case oLoggerFD: log_set_logfile( NULL, iobuf_translate_file_handle (pargs.r.ret_int, 1) ); break; +#ifdef __riscos__ + case oLoggerFile: + log_set_logfile( NULL, + iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 1), 1) ); + break; +#endif /* __riscos__ */ case oWithFingerprint: with_fpr=1; /*fall thru*/ case oFingerprint: opt.fingerprint++; break; @@ -876,8 +923,12 @@ main( int argc, char **argv ) case aListSecretKeys: set_cmd( &cmd, aListSecretKeys); break; case oAlwaysTrust: opt.always_trust = 1; break; case oLoadExtension: +#ifndef __riscos__ register_cipher_extension(orig_argc? *orig_argv:NULL, pargs.r.ret_str); +#else /* __riscos__ */ + not_implemented("load-extension"); +#endif /* __riscos__ */ break; case oRFC1991: opt.rfc1991 = 1; @@ -906,11 +957,15 @@ main( int argc, char **argv ) case oEmuMDEncodeBug: opt.emulate_bugs |= EMUBUG_MDENCODE; break; case oCompressSigs: opt.compress_sigs = 1; break; case oRunAsShmCP: +#ifndef __riscos__ #ifndef USE_SHM_COPROCESSING /* not possible in the option file, * but we print the warning here anyway */ log_error("shared memory coprocessing is not available\n"); #endif +#else /* __riscos__ */ + not_implemented("run-as-shm-coprocess"); +#endif /* __riscos__ */ break; case oSetFilename: opt.set_filename = pargs.r.ret_str; break; case oSetPolicyURL: opt.set_policy_url = pargs.r.ret_str; break; @@ -941,9 +996,19 @@ main( int argc, char **argv ) case oPasswdFD: pwfd = iobuf_translate_file_handle (pargs.r.ret_int, 0); break; +#ifdef __riscos__ + case oPasswdFile: + pwfd = iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 0), 0); + break; +#endif /* __riscos__ */ case oCommandFD: opt.command_fd = iobuf_translate_file_handle (pargs.r.ret_int, 0); break; +#ifdef __riscos__ + case oCommandFile: + opt.command_fd = iobuf_translate_file_handle ( fdopenfile (pargs.r.ret_str, 0), 0); + break; +#endif /* __riscos__ */ case oCipherAlgo: def_cipher_string = m_strdup(pargs.r.ret_str); break; case oDigestAlgo: def_digest_string = m_strdup(pargs.r.ret_str); break; case oNoSecmemWarn: secmem_set_flags( secmem_get_flags() | 1 ); break; @@ -956,7 +1021,13 @@ main( int argc, char **argv ) case oEscapeFrom: opt.escape_from = 1; break; case oLockOnce: opt.lock_once = 1; break; case oLockNever: disable_dotlock(); break; - case oLockMultiple: opt.lock_once = 0; break; + case oLockMultiple: + opt.lock_once = 0; +#ifdef __riscos__ + not_implemented("lock-multiple"); +#endif + break; + case oKeyServer: opt.keyserver_name = pargs.r.ret_str; break; case oNotation: add_notation_data( pargs.r.ret_str ); break; case oUtf8Strings: utf8_strings = 1; break; @@ -1098,6 +1169,13 @@ main( int argc, char **argv ) if (preference_list && keygen_set_std_prefs (preference_list)) log_error(_("invalid preferences\n")); +#ifdef __riscos__ + if (opt.use_agent) { + opt.use_agent = 0; + not_implemented ("use-agent"); + } +#endif + if( log_get_errorcount(0) ) g10_exit(2); @@ -1141,11 +1219,11 @@ main( int argc, char **argv ) && !(cmd == aKMode && argc == 2 ) ) { if( !sec_nrings || default_keyring ) /* add default secret rings */ - add_keyblock_resource("secring.gpg", 0, 1); + add_keyblock_resource("secring" EXTSEP_S "gpg", 0, 1); for(sl = sec_nrings; sl; sl = sl->next ) add_keyblock_resource( sl->d, 0, 1 ); if( !nrings || default_keyring ) /* add default ring */ - add_keyblock_resource("pubring.gpg", 0, 0); + add_keyblock_resource("pubring" EXTSEP_S "gpg", 0, 0); for(sl = nrings; sl; sl = sl->next ) add_keyblock_resource( sl->d, 0, 0 ); } diff --git a/g10/gpgv.c b/g10/gpgv.c index c1e2bd370..64dcfe64b 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -28,8 +28,11 @@ #ifdef HAVE_DOSISH_SYSTEM #include <fcntl.h> /* for setmode() */ #endif +#ifdef __riscos__ +#include <unixlib/local.h> +#endif /* __riscos__ */ - +#define INCLUDED_BY_MAIN_MODULE 1 #include "packet.h" #include "iobuf.h" #include "memory.h" @@ -136,6 +139,9 @@ main( int argc, char **argv ) STRLIST sl; STRLIST nrings=NULL; unsigned configlineno; + #ifdef __riscos__ + __riscosify_control = __RISCOSIFY_NO_PROCESS; + #endif /* __riscos__ */ log_set_name("gpgv"); init_signals(); @@ -183,7 +189,7 @@ main( int argc, char **argv ) set_packet_list_mode(1); if( !nrings ) /* no keyring given: use default one */ - add_keyblock_resource("trustedkeys.gpg", 0, 0); + add_keyblock_resource("trustedkeys" EXTSEP_S "gpg", 0, 0); for(sl = nrings; sl; sl = sl->next ) add_keyblock_resource( sl->d, 0, 0 ); diff --git a/g10/openfile.c b/g10/openfile.c index 2baf5a191..1bc4cf04c 100644 --- a/g10/openfile.c +++ b/g10/openfile.c @@ -39,10 +39,10 @@ #ifdef USE_ONLY_8DOT3 #define SKELEXT ".skl" #else - #define SKELEXT ".skel" + #define SKELEXT EXTSEP_S "skel" #endif -#ifdef HAVE_DRIVE_LETTERS +#if defined (HAVE_DRIVE_LETTERS) || defined (__riscos__) #define CMP_FILENAME(a,b) ascii_strcasecmp( (a), (b) ) #else #define CMP_FILENAME(a,b) strcmp( (a), (b) ) @@ -102,15 +102,15 @@ make_outfile_name( const char *iname ) return m_strdup("-"); n = strlen(iname); - if( n > 4 && ( !CMP_FILENAME(iname+n-4,".gpg") - || !CMP_FILENAME(iname+n-4,".pgp") - || !CMP_FILENAME(iname+n-4,".sig") - || !CMP_FILENAME(iname+n-4,".asc") ) ) { + if( n > 4 && ( !CMP_FILENAME(iname+n-4, EXTSEP_S "gpg") + || !CMP_FILENAME(iname+n-4, EXTSEP_S "pgp") + || !CMP_FILENAME(iname+n-4, EXTSEP_S "sig") + || !CMP_FILENAME(iname+n-4, EXTSEP_S "asc") ) ) { char *buf = m_strdup( iname ); buf[n-4] = 0; return buf; } - else if( n > 5 && !CMP_FILENAME(iname+n-5,".sign") ) { + else if( n > 5 && !CMP_FILENAME(iname+n-5, EXTSEP_S "sign") ) { char *buf = m_strdup( iname ); buf[n-5] = 0; return buf; @@ -217,8 +217,8 @@ open_outfile( const char *iname, int mode, IOBUF *a ) strcat( buf, newsfx ); #else buf = m_alloc(strlen(iname)+4+1); - strcpy(stpcpy(buf,iname), mode==1 ? ".asc" : - mode==2 ? ".sig" : ".gpg"); + strcpy(stpcpy(buf,iname), mode==1 ? EXTSEP_S "asc" : + mode==2 ? EXTSEP_S "sig" : EXTSEP_S "gpg"); #endif name = buf; } @@ -262,9 +262,9 @@ open_sigfile( const char *iname ) if( iname && !(*iname == '-' && !iname[1]) ) { len = strlen(iname); - if( len > 4 && ( !strcmp(iname + len - 4, ".sig") - || ( len > 5 && !strcmp(iname + len - 5, ".sign") ) - || !strcmp(iname + len - 4, ".asc")) ) { + if( len > 4 && ( !strcmp(iname + len - 4, EXTSEP_S "sig") + || ( len > 5 && !strcmp(iname + len - 5, EXTSEP_S "sign") ) + || !strcmp(iname + len - 4, EXTSEP_S "asc")) ) { char *buf; buf = m_strdup(iname); buf[len-(buf[len-1]=='n'?5:4)] = 0 ; @@ -294,14 +294,14 @@ copy_options_file( const char *destdir ) return; fname = m_alloc( strlen(datadir) + strlen(destdir) + 15 ); - strcpy(stpcpy(fname, datadir), "/options" SKELEXT ); + strcpy(stpcpy(fname, datadir), DIRSEP_S "options" SKELEXT ); src = fopen( fname, "r" ); if( !src ) { log_error(_("%s: can't open: %s\n"), fname, strerror(errno) ); m_free(fname); return; } - strcpy(stpcpy(fname, destdir), "/options" ); + strcpy(stpcpy(fname, destdir), DIRSEP_S "options" ); dst = fopen( fname, "w" ); if( !dst ) { log_error(_("%s: can't create: %s\n"), fname, strerror(errno) ); diff --git a/g10/options.h b/g10/options.h index ffd4e574c..43b547c24 100644 --- a/g10/options.h +++ b/g10/options.h @@ -24,7 +24,16 @@ #undef ENABLE_COMMENT_PACKETS /* don't create comment packets */ +#ifndef EXTERN_UNLESS_MAIN_MODULE +/* Norcraft can't cope with common symbols */ + #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) + #define EXTERN_UNLESS_MAIN_MODULE extern + #else + #define EXTERN_UNLESS_MAIN_MODULE + #endif +#endif +EXTERN_UNLESS_MAIN_MODULE struct { int verbose; int quiet; diff --git a/g10/passphrase.c b/g10/passphrase.c index a34ebbd61..c626e9adc 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -25,7 +25,7 @@ #include <string.h> #include <unistd.h> #include <assert.h> -#ifndef HAVE_DOSISH_SYSTEM +#if !defined(HAVE_DOSISH_SYSTEM) && !defined(__riscos__) #include <sys/socket.h> #include <sys/un.h> #endif @@ -64,7 +64,7 @@ enum gpga_protocol_codes { GPGA_PROT_BAD_PASSPHRASE = 0x20005, GPGA_PROT_INVALID_DATA = 0x20006, GPGA_PROT_NOT_IMPLEMENTED= 0x20007, - GPGA_PROT_UI_PROBLEM = 0x20008, + GPGA_PROT_UI_PROBLEM = 0x20008 }; @@ -153,7 +153,7 @@ read_passphrase_from_fd( int fd ) fd_passwd = pw; } -#ifndef HAVE_DOSISH_SYSTEM +#if !defined(HAVE_DOSISH_SYSTEM) && !defined(__riscos__) static int writen ( int fd, const void *buf, size_t nbytes ) { @@ -265,7 +265,7 @@ agent_close ( int fd ) { close (fd); } -#endif /* !HAVE_DOSISH_SYSTEM */ +#endif /* !HAVE_DOSISH_SYSTEM && !__riscos__ */ /* @@ -277,7 +277,7 @@ agent_close ( int fd ) static char * agent_get_passphrase ( u32 *keyid, int mode ) { - #ifdef HAVE_DOSISH_SYSTEM + #if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__) return NULL; #else @@ -427,7 +427,7 @@ agent_get_passphrase ( u32 *keyid, int mode ) void passphrase_clear_cache ( u32 *keyid, int algo ) { - #ifdef HAVE_DOSISH_SYSTEM + #if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__) return ; #else size_t n; diff --git a/g10/pkclist.c b/g10/pkclist.c index 8c4fa6bac..61b2c8000 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -418,7 +418,7 @@ add_ownertrust_cb( ulong lid ) * Returns: -1 if no ownertrust were added. */ static int -add_ownertrust( PKT_public_key *pk, int *quit, unsigned *trustlevel ) +add_ownertrust( PKT_public_key *pk, int *quit, int *trustlevel ) { int rc; unsigned flags = 0; diff --git a/g10/plaintext.c b/g10/plaintext.c index f883f4a73..b559a90b2 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -105,8 +105,12 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, if( fp || nooutput ) ; else if( !(fp = fopen(fname,"wb")) ) { - log_error("Error creating `%s': %s\n", fname, strerror(errno) ); + log_error(_("error creating `%s': %s\n"), fname, strerror(errno) ); rc = G10ERR_CREATE_FILE; +#ifdef __riscos__ + if (errno == 106) + log_info("perhaps the output file has the same name as the input file?\n"); +#endif /* __riscos__ */ goto leave; } diff --git a/g10/ringedit.c b/g10/ringedit.c index 4499f65f4..b2193e7e2 100644 --- a/g10/ringedit.c +++ b/g10/ringedit.c @@ -214,17 +214,17 @@ add_keyblock_resource( const char *url, int force, int secret ) rt = rt_GDBM; resname += 11; } - #ifndef HAVE_DRIVE_LETTERS + #if !defined(HAVE_DRIVE_LETTERS) && !defined(__riscos__) else if( strchr( resname, ':' ) ) { log_error("%s: invalid URL\n", url ); rc = G10ERR_GENERAL; goto leave; } - #endif + #endif /* !HAVE_DRIVE_LETTERS && !__riscos__ */ } - if( *resname != '/' ) { /* do tilde expansion etc */ - if( strchr(resname, '/') ) + if( *resname != DIRSEP_C ) { /* do tilde expansion etc */ + if( strchr(resname, DIRSEP_C) ) filename = make_filename(resname, NULL); else filename = make_filename(opt.homedir, resname, NULL); @@ -282,7 +282,7 @@ add_keyblock_resource( const char *url, int force, int secret ) if( !iobuf ) { char *last_slash_in_filename; - last_slash_in_filename = strrchr(filename, '/'); + last_slash_in_filename = strrchr(filename, DIRSEP_C); *last_slash_in_filename = 0; if( access(filename, F_OK) ) { @@ -292,11 +292,11 @@ add_keyblock_resource( const char *url, int force, int secret ) */ try_make_homedir( filename ); rc = G10ERR_OPEN_FILE; - *last_slash_in_filename = '/'; + *last_slash_in_filename = DIRSEP_C; goto leave; } - *last_slash_in_filename = '/'; + *last_slash_in_filename = DIRSEP_C; iobuf = iobuf_create( filename ); if( !iobuf ) { @@ -447,8 +447,8 @@ get_writable_keyblock_file( int secret ) } } /* Assume the home dir is always writable */ - return make_filename(opt.homedir, secret? "secring.gpg" - : "pubring.gpg", NULL ); + return make_filename(opt.homedir, secret? "secring" EXTSEP_S "gpg" + : "pubring" EXTSEP_S "gpg", NULL ); } @@ -1413,25 +1413,25 @@ keyring_copy( KBPOS *kbpos, int mode, KBNODE root ) * works. So we replace .gpg by .bak or .tmp */ if( strlen(rentry->fname) > 4 - && !strcmp(rentry->fname+strlen(rentry->fname)-4, ".gpg") ) { + && !strcmp(rentry->fname+strlen(rentry->fname)-4, EXTSEP_S "gpg") ) { bakfname = m_alloc( strlen( rentry->fname ) + 1 ); strcpy(bakfname,rentry->fname); - strcpy(bakfname+strlen(rentry->fname)-4, ".bak"); + strcpy(bakfname+strlen(rentry->fname)-4, EXTSEP_S "bak"); tmpfname = m_alloc( strlen( rentry->fname ) + 1 ); strcpy(tmpfname,rentry->fname); - strcpy(tmpfname+strlen(rentry->fname)-4, ".tmp"); + strcpy(tmpfname+strlen(rentry->fname)-4, EXTSEP_S "tmp"); } else { /* file does not end with gpg; hmmm */ bakfname = m_alloc( strlen( rentry->fname ) + 5 ); - strcpy(stpcpy(bakfname,rentry->fname),".bak"); + strcpy(stpcpy(bakfname,rentry->fname), EXTSEP_S "bak"); tmpfname = m_alloc( strlen( rentry->fname ) + 5 ); - strcpy(stpcpy(tmpfname,rentry->fname),".tmp"); + strcpy(stpcpy(tmpfname,rentry->fname), EXTSEP_S "tmp"); } #else bakfname = m_alloc( strlen( rentry->fname ) + 2 ); strcpy(stpcpy(bakfname,rentry->fname),"~"); tmpfname = m_alloc( strlen( rentry->fname ) + 5 ); - strcpy(stpcpy(tmpfname,rentry->fname),".tmp"); + strcpy(stpcpy(tmpfname,rentry->fname), EXTSEP_S "tmp"); #endif newfp = iobuf_create( tmpfname ); if( !newfp ) { @@ -1534,7 +1534,7 @@ keyring_copy( KBPOS *kbpos, int mode, KBNODE root ) if( !rentry->secret ) { /* but not for secret keyrings */ iobuf_ioctl (NULL, 2, 0, bakfname ); iobuf_ioctl (NULL, 2, 0, rentry->fname ); - #ifdef HAVE_DOSISH_SYSTEM + #if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__) remove( bakfname ); #endif if( rename( rentry->fname, bakfname ) ) { @@ -1546,7 +1546,7 @@ keyring_copy( KBPOS *kbpos, int mode, KBNODE root ) } iobuf_ioctl (NULL, 2, 0, tmpfname ); iobuf_ioctl (NULL, 2, 0, rentry->fname ); - #ifdef HAVE_DOSISH_SYSTEM + #if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__) remove( rentry->fname ); #endif if( rename( tmpfname, rentry->fname ) ) { diff --git a/g10/signal.c b/g10/signal.c index 512f56368..e768e0cf3 100644 --- a/g10/signal.c +++ b/g10/signal.c @@ -42,7 +42,7 @@ static void init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign ) { #ifndef HAVE_DOSISH_SYSTEM - #if HAVE_SIGACTION + #ifdef HAVE_SIGACTION struct sigaction oact, nact; if (check_ign) { @@ -99,6 +99,9 @@ got_fatal_signal( int sig ) /* reset action to default action and raise signal again */ init_one_signal (sig, SIG_DFL, 0); remove_lockfiles (); +#ifdef __riscos__ + close_fds (); +#endif /* __riscos__ */ raise( sig ); } diff --git a/g10/tdbio.c b/g10/tdbio.c index e9c9457dd..de900e7ee 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -417,7 +417,8 @@ tdbio_set_dbname( const char *new_dbname, int create ) initialized = 1; } fname = new_dbname? m_strdup( new_dbname ) - : make_filename(opt.homedir, "trustdb.gpg", NULL ); + : make_filename(opt.homedir, + "trustdb" EXTSEP_S "gpg", NULL ); if( access( fname, R_OK ) ) { if( errno != ENOENT ) { @@ -429,7 +430,7 @@ tdbio_set_dbname( const char *new_dbname, int create ) FILE *fp; TRUSTREC rec; int rc; - char *p = strrchr( fname, '/' ); + char *p = strrchr( fname, DIRSEP_C ); assert(p); *p = 0; @@ -437,14 +438,22 @@ tdbio_set_dbname( const char *new_dbname, int create ) try_make_homedir( fname ); log_fatal( _("%s: directory does not exist!\n"), fname ); } - *p = '/'; + *p = DIRSEP_C; + m_free(db_name); + db_name = fname; +#ifdef __riscos__ + if( !lockhandle ) + lockhandle = create_dotlock( db_name ); + if( !lockhandle ) + log_fatal( _("%s: can't create lock\n"), db_name ); + if( make_dotlock( lockhandle, -1 ) ) + log_fatal( _("%s: can't make lock\n"), db_name ); +#endif /* __riscos__ */ fp =fopen( fname, "wb" ); if( !fp ) log_fatal( _("%s: can't create: %s\n"), fname, strerror(errno) ); fclose(fp); - m_free(db_name); - db_name = fname; #ifdef HAVE_DOSISH_SYSTEM db_fd = open( db_name, O_RDWR | O_BINARY ); #else @@ -453,10 +462,12 @@ tdbio_set_dbname( const char *new_dbname, int create ) if( db_fd == -1 ) log_fatal( _("%s: can't open: %s\n"), db_name, strerror(errno) ); +#ifndef __riscos__ if( !lockhandle ) lockhandle = create_dotlock( db_name ); if( !lockhandle ) log_fatal( _("%s: can't create lock\n"), db_name ); +#endif /* !__riscos__ */ memset( &rec, 0, sizeof rec ); rec.r.ver.version = 2; @@ -506,6 +517,10 @@ open_db() lockhandle = create_dotlock( db_name ); if( !lockhandle ) log_fatal( _("%s: can't create lock\n"), db_name ); +#ifdef __riscos__ + if( make_dotlock( lockhandle, -1 ) ) + log_fatal( _("%s: can't make lock\n"), db_name ); +#endif /* __riscos__ */ #ifdef HAVE_DOSISH_SYSTEM db_fd = open( db_name, O_RDWR | O_BINARY ); #else diff --git a/g10/trustdb.c b/g10/trustdb.c index b8a4d8b12..b9c344f50 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -2301,11 +2301,11 @@ query_trust_record( PKT_public_key *pk ) * is not necessary to check this if we use a local pubring. Hmmmm. */ int -check_trust( PKT_public_key *pk, unsigned *r_trustlevel, +check_trust( PKT_public_key *pk, int *r_trustlevel, const byte *namehash, int (*add_fnc)(ulong), unsigned *retflgs ) { TRUSTREC rec; - unsigned trustlevel = TRUST_UNKNOWN; + unsigned int trustlevel = TRUST_UNKNOWN; int rc=0; u32 cur_time; u32 keyid[2]; diff --git a/g10/trustdb.h b/g10/trustdb.h index 183088723..81180a429 100644 --- a/g10/trustdb.h +++ b/g10/trustdb.h @@ -45,7 +45,7 @@ void update_trustdb( void ); int setup_trustdb( int level, const char *dbname ); void init_trustdb( void ); void sync_trustdb( void ); -int check_trust( PKT_public_key *pk, unsigned *r_trustlevel, +int check_trust( PKT_public_key *pk, int *r_trustlevel, const byte* nh, int (*add_fnc)(ulong), unsigned *retflgs ); int query_trust_info( PKT_public_key *pk, const byte *nh ); int enum_cert_paths( void **context, ulong *lid, |