(set_field): try another way to calculate the path to the

database/logfile/signal-socket


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16321 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-11-30 12:39:19 +00:00
parent 665577dc46
commit ad3f3d8f3c

View File

@@ -74,11 +74,21 @@ set_field(krb5_context context, const krb5_config_binding *binding,
if(p)
*variable = strdup(p);
else {
const char *p1;
p = strrchr(dbname, '.');
if(p == NULL)
asprintf(variable, "%s.%s", dbname, ext);
p1 = strrchr(dbname, '/');
if (p1) {
p1++;
if (p1 > p)
p = p1 + strlen(p1);
}
if(p1 == NULL)
asprintf(variable, "%s/%s.%s", HDB_DB_DIR, dbname, ext);
else
asprintf(variable, "%.*s.%s", (int)(p - dbname), dbname, ext);
asprintf(variable, "%.*s/%.*s.%s",
(int)(p1 - dbname), dbname,
(int)(p - p1), p1,
ext);
}
}