From: Russ Allbery Date: Tue, 1 Jul 2008 06:59:20 +0000 (+0000) Subject: STABLE14-pt_util-database-path-20080630 X-Git-Tag: openafs-stable-1_4_8pre1~56 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2a8bb17860b80d76404c5f4afe5a513c9ea8d58c;p=packages%2Fo%2Fopenafs.git STABLE14-pt_util-database-path-20080630 LICENSE BSD Use the dirpath functions to find the prdb database path in pt_util instead of hard-coding the default Transarc path. (cherry picked from commit 5e1459f431fc046dfd3b25aca87709193ccca211) --- diff --git a/src/ptserver/pt_util.c b/src/ptserver/pt_util.c index 1b276b836..d34f44136 100644 --- a/src/ptserver/pt_util.c +++ b/src/ptserver/pt_util.c @@ -26,6 +26,7 @@ RCSID ("$Header$"); #include /*Command line parsing */ +#include #include #include #include @@ -137,7 +138,9 @@ CommandProc(register struct cmd_syndesc *a_as, void *arock) struct prentry uentry, gentry; struct ubik_hdr *uh; char *dfile = 0; - char *pfile = "/usr/afs/db/prdb.DB0"; + char *pbase = AFSDIR_SERVER_PRDB_FILEPATH; + char *pfile = NULL; + char pbuffer[1028]; struct cmd_parmdesc *tparm; tparm = a_as->parms; @@ -170,6 +173,10 @@ CommandProc(register struct cmd_syndesc *a_as, void *arock) dfile = tparm[8].items->data; } + if (pfile == NULL) { + afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0", pbase); + pfile = pbuffer; + } if ((dbase_fd = open(pfile, (wflag ? O_RDWR : O_RDONLY) | O_CREAT, 0600)) < 0) { fprintf(stderr, "pt_util: cannot open %s: %s\n", pfile,