Browse Source

Parse and store the socket directory and name for ckdb

master
Con Kolivas 11 years ago
parent
commit
5f5ef3c712
  1. 17
      src/ckpool.c
  2. 5
      src/ckpool.h

17
src/ckpool.c

@ -750,11 +750,14 @@ int main(int argc, char **argv)
memset(&ckp, 0, sizeof(ckp));
ckp.loglevel = LOG_NOTICE;
while ((c = getopt(argc, argv, "c:g:kl:n:ps:")) != -1) {
while ((c = getopt(argc, argv, "c:d:g:kl:n:pS:s:")) != -1) {
switch (c) {
case 'c':
ckp.config = optarg;
break;
case 'd':
ckp.ckdb_name = optarg;
break;
case 'g':
ckp.grpnam = optarg;
break;
@ -774,6 +777,8 @@ int main(int argc, char **argv)
case 'p':
ckp.proxy = true;
break;
case 'S':
ckp.ckdb_sockdir = strdup(optarg);
case 's':
ckp.socket_dir = strdup(optarg);
break;
@ -809,6 +814,16 @@ int main(int argc, char **argv)
}
trail_slash(&ckp.socket_dir);
if (!ckp.ckdb_name)
ckp.ckdb_name = "ckdb";
if (!ckp.ckdb_sockdir) {
ckp.ckdb_sockdir = strdup("/opt/");
realloc_strcat(&ckp.ckdb_sockdir, ckp.ckdb_name);
}
trail_slash(&ckp.ckdb_sockdir);
ckp.ckdb_sockname = ckp.ckdb_sockdir;
realloc_strcat(&ckp.ckdb_sockdir, "listener");
/* Ignore sigpipe */
signal(SIGPIPE, SIG_IGN);

5
src/ckpool.h

@ -67,6 +67,11 @@ struct ckpool_instance {
char *name;
/* Directory where sockets are created */
char *socket_dir;
/* Directory where ckdb sockets are */
char *ckdb_sockdir;
/* Name of the ckdb process */
char *ckdb_name;
char *ckdb_sockname;
/* Group ID for unix sockets */
char *grpnam;
gid_t gr_gid;

Loading…
Cancel
Save