diff options
author | Werner Koch <[email protected]> | 2002-09-11 07:27:54 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2002-09-11 07:27:54 +0000 |
commit | c5445cc3239e7654fbaf145c6e697de54093892f (patch) | |
tree | fb8e0b6e5018951bd13aade5f46b3444d2fe005c /g10/tdbio.c | |
parent | * exec.c (expand_args): Remove loop left over from earlier implementation. (diff) | |
download | gnupg-c5445cc3239e7654fbaf145c6e697de54093892f.tar.gz gnupg-c5445cc3239e7654fbaf145c6e697de54093892f.zip |
* g10.c, options.h: Removed option --emulate-checksum-bug.
* misc.c (checksum_u16_nobug): Removed.
(checksum_u16): Removed the bug emulation.
(checksum_mpi): Ditto.
(checksum_mpi_counted_nbits): Removed and replaced all calls
with checksum_mpi.
* parse-packet.c (read_protected_v3_mpi): New.
(parse_key): Use it here to store it as an opaque MPI.
* seckey-cert.c (do_check): Changed the v3 unprotection to the new
why to store these keys.
(protect_secret_key): Likewise.
* build-packet.c (do_secret_key): And changed the writing.
Diffstat (limited to 'g10/tdbio.c')
-rw-r--r-- | g10/tdbio.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/g10/tdbio.c b/g10/tdbio.c index cdeba46cf..62ff26774 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -43,6 +43,13 @@ #define ftruncate chsize #endif +#ifdef HAVE_DOSISH_SYSTEM +#define MY_O_BINARY O_BINARY +#else +#define MY_O_BINARY 0 +#endif + + /**************** * Yes, this is a very simple implementation. We should really * use a page aligned buffer and read complete pages. @@ -484,11 +491,7 @@ tdbio_set_dbname( const char *new_dbname, int create ) if( !fp ) log_fatal( _("%s: can't create: %s\n"), fname, strerror(errno) ); fclose(fp); - #ifdef HAVE_DOSISH_SYSTEM - db_fd = open( db_name, O_RDWR | O_BINARY ); - #else - db_fd = open( db_name, O_RDWR ); - #endif + db_fd = open( db_name, O_RDWR | MY_O_BINARY ); if( db_fd == -1 ) log_fatal( _("%s: can't open: %s\n"), db_name, strerror(errno) ); @@ -544,11 +547,12 @@ open_db() 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 - db_fd = open (db_name, O_RDWR ); -#endif + db_fd = open (db_name, O_RDWR | MY_O_BINARY ); + if (db_fd == -1 && errno == EACCES) { + db_fd = open (db_name, O_RDONLY | MY_O_BINARY ); + if (db_fd != -1) + log_info (_("NOTE: trustdb not writable\n")); + } if ( db_fd == -1 ) log_fatal( _("%s: can't open: %s\n"), db_name, strerror(errno) ); |