* tdbio.c (tdbio_set_dbname): Fix assertion failure with
authorDavid Shaw <dshaw@jabberwocky.com>
Sun, 12 Jan 2003 15:46:17 +0000 (15:46 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Sun, 12 Jan 2003 15:46:17 +0000 (15:46 +0000)
non-fully-qualified trustdb names.

g10/ChangeLog
g10/tdbio.c

index 716705b..7b9d244 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-12  David Shaw  <dshaw@jabberwocky.com>
+
+       * tdbio.c (tdbio_set_dbname): Fix assertion failure with
+       non-fully-qualified trustdb names.
+
 2003-01-11  David Shaw  <dshaw@jabberwocky.com>
 
        * trustdb.c (get_validity_info, get_ownertrust_info,
index c7f04f4..47dc51e 100644 (file)
@@ -474,9 +474,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 ) {