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)); memset(&ckp, 0, sizeof(ckp));
ckp.loglevel = LOG_NOTICE; 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) { switch (c) {
case 'c': case 'c':
ckp.config = optarg; ckp.config = optarg;
break; break;
case 'd':
ckp.ckdb_name = optarg;
break;
case 'g': case 'g':
ckp.grpnam = optarg; ckp.grpnam = optarg;
break; break;
@ -774,6 +777,8 @@ int main(int argc, char **argv)
case 'p': case 'p':
ckp.proxy = true; ckp.proxy = true;
break; break;
case 'S':
ckp.ckdb_sockdir = strdup(optarg);
case 's': case 's':
ckp.socket_dir = strdup(optarg); ckp.socket_dir = strdup(optarg);
break; break;
@ -809,6 +814,16 @@ int main(int argc, char **argv)
} }
trail_slash(&ckp.socket_dir); 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 */ /* Ignore sigpipe */
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);

5
src/ckpool.h

@ -67,6 +67,11 @@ struct ckpool_instance {
char *name; char *name;
/* Directory where sockets are created */ /* Directory where sockets are created */
char *socket_dir; 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 */ /* Group ID for unix sockets */
char *grpnam; char *grpnam;
gid_t gr_gid; gid_t gr_gid;

Loading…
Cancel
Save