-sprintf(CS buffer, "%s/db/%s", spool_directory, name);
-DEBUG(D_hints_lookup) debug_printf("EXIM_DBOPEN(%s)\n", buffer);
-EXIM_DBOPEN(buffer, flags, EXIMDB_MODE, &(dbblock->dbptr));
+snprintf(CS filename, sizeof(filename), "%s/%s", dirname, name);
+DEBUG(D_hints_lookup) debug_printf("EXIM_DBOPEN(%s)\n", filename);
+EXIM_DBOPEN(filename, dirname, flags, EXIMDB_MODE, &(dbblock->dbptr));