From d65d805aad63d00e4b41b7b003a1866d1a93f612 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Sun, 12 Jan 2003 15:08:16 +0000 Subject: [PATCH] * tdbio.c (tdbio_set_dbname): Fix assertion failure with non-fully-qualified trustdb names. --- g10/ChangeLog | 5 +++++ g10/tdbio.c | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 655d204d8..5f183815e 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,8 @@ +2003-01-12 David Shaw + + * tdbio.c (tdbio_set_dbname): Fix assertion failure with + non-fully-qualified trustdb names. + 2003-01-10 David Shaw * trustdb.h, trustdb.c (trust_letter): Make static. diff --git a/g10/tdbio.c b/g10/tdbio.c index aa5c4b7d5..0f2f90b86 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -450,9 +450,18 @@ tdbio_set_dbname( const char *new_dbname, int create ) atexit( cleanup ); initialized = 1; } - fname = new_dbname? m_strdup( new_dbname ) - : make_filename(opt.homedir, - "trustdb" EXTSEP_S "gpg", NULL ); + + if(new_dbname==NULL) + fname=make_filename(opt.homedir,"trustdb" EXTSEP_S "gpg", NULL); + else if (*new_dbname != DIRSEP_C ) + { + if (strchr(new_dbname, DIRSEP_C) ) + fname = make_filename (new_dbname, NULL); + else + fname = make_filename (opt.homedir, new_dbname, NULL); + } + else + fname = m_strdup (new_dbname); if( access( fname, R_OK ) ) { if( errno != ENOENT ) {