j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes: > Sebastien Marie <sema...@openbsd.org> writes: > >> On Sun, Jan 31, 2016 at 09:39:52AM +0100, Landry Breuil wrote: >>> Hi, >>> >>> i'm tinkering with ldapd and writing regress tests for it, and to >>> allow running independent instances (with separate port/control >>> socket/etc) i needed to add the possibility to specify an alternative >>> datadir, which was so far #defined in the code. >>> Patch is pretty simple and works fine, i'm open to suggestions of course >>> on a better wording for the manpage and option choose (i went for -r..) >>> okays welcome too ! >>> >> >> the diff looks good and it would permit to make regress tests, so OK >> semarie@ :) > > I have smallish tweaks to propose but nothing that prevents this diff to > go in as is. ok jca@
The tweaks that I had in mind: - the string pointed to by datadir should not be modified - we can initialize datadir at compile time - in namespace.c move the datadir decl above local decls Index: ldapd.c =================================================================== RCS file: /cvs/src/usr.sbin/ldapd/ldapd.c,v retrieving revision 1.18 diff -u -p -r1.18 ldapd.c --- ldapd.c 2 Feb 2016 14:59:20 -0000 1.18 +++ ldapd.c 2 Feb 2016 18:22:12 -0000 @@ -51,7 +51,7 @@ static void ldapd_cleanup(char *); struct ldapd_stats stats; pid_t ldape_pid; -char * datadir; +const char *datadir = DATADIR; void usage(void) @@ -120,7 +120,6 @@ main(int argc, char *argv[]) struct event ev_sighup; struct stat sb; - datadir = DATADIR; log_init(1); /* log to stderr until daemonized */ while ((c = getopt(argc, argv, "dhvD:f:nr:s:")) != -1) { Index: namespace.c =================================================================== RCS file: /cvs/src/usr.sbin/ldapd/namespace.c,v retrieving revision 1.15 diff -u -p -r1.15 namespace.c --- namespace.c 1 Feb 2016 20:00:18 -0000 1.15 +++ namespace.c 2 Feb 2016 18:22:12 -0000 @@ -28,6 +28,8 @@ #include "ldapd.h" +extern const char *datadir; + /* Maximum number of requests to queue per namespace during compaction. * After this many requests, we return LDAP_BUSY. */ @@ -38,7 +40,6 @@ static void namespace_queue_replay(int static int namespace_set_fd(struct namespace *ns, struct btree **bt, int fd, unsigned int flags); -extern char *datadir; int namespace_begin_txn(struct namespace *ns, struct btree_txn **data_txn, struct btree_txn **indx_txn, int rdonly) -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE