From: Art Cancro Date: Fri, 29 Jul 2005 19:00:15 +0000 (+0000) Subject: * Made some changes to the hunt for citadel.socket when built in X-Git-Tag: v7.86~4759 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=a2064d9cbe3f5b695eed74faef19ef3f46519d8e;p=citadel.git * Made some changes to the hunt for citadel.socket when built in legacy mode --- diff --git a/citadel/citadel_ipc.c b/citadel/citadel_ipc.c index e519e8707..eec241329 100644 --- a/citadel/citadel_ipc.c +++ b/citadel/citadel_ipc.c @@ -2940,23 +2940,14 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf) /* If we're using a unix domain socket we can do a bunch of stuff */ if (!strcmp(cithost, UDS)) { if (!strcasecmp(citport, DEFAULT_PORT)) { - snprintf(sockpath, sizeof sockpath, "%s%s", -#ifndef HAVE_RUN_DIR - CTDLDIR +#ifdef HAVE_RUN_DIR + snprintf(sockpath, sizeof sockpath, RUNDIR "/citadel.socket"); #else - RUN_DIR + snprintf(sockpath, sizeof sockpath, CTDLDIR "/citadel.socket"); #endif - , "/citadel.socket"); } else { - snprintf(sockpath, sizeof sockpath, "%s%s", - citport, -#ifndef HAVE_RUN_DIR - CTDLDIR -#else - RUN_DIR -#endif - "/citadel.socket"); + snprintf(sockpath, sizeof sockpath, "%s/%s", citport, "citadel.socket"); } ipc->sock = uds_connectsock(&(ipc->isLocal), sockpath); if (ipc->sock == -1) { diff --git a/citadel/sendcommand.c b/citadel/sendcommand.c index e5cab9aa8..fdbc88d68 100644 --- a/citadel/sendcommand.c +++ b/citadel/sendcommand.c @@ -102,23 +102,17 @@ void logoff(int e) /* * Connect sendcommand to the Citadel server running on this computer. */ -void np_attach_to_server(void) +void np_attach_to_server(char *host, char *port) { - char hostbuf[SIZ], portbuf[SIZ]; char buf[SIZ]; + char hostbuf[256], portbuf[256]; char *args[] = {"sendcommand", NULL}; int r; - strcpy(hostbuf, UDS); /* Only run on a unix domain socket */ - strcpy(portbuf, -#ifndef HAVE_RUN_DIR - "." /* IPGM will refuse to run on the network */ -#else - "" -#endif - ); fprintf(stderr, "Attaching to server...\n"); + strcpy(hostbuf, host); + strcpy(portbuf, port); ipc = CtdlIPC_new(1, args, hostbuf, portbuf); if (!ipc) { fprintf(stderr, "Can't connect: %s\n", strerror(errno)); @@ -149,7 +143,7 @@ int main(int argc, char **argv) char cmd[SIZ]; char buf[SIZ]; - strcpy(ctdl_home_directory, CTDLDIR); + strcpy(ctdl_home_directory, DEFAULT_PORT); strcpy(cmd, ""); /* @@ -179,7 +173,7 @@ int main(int argc, char **argv) (int) getpid(), ctdl_home_directory); fflush(stderr); - np_attach_to_server(); + np_attach_to_server(UDS, ctdl_home_directory); fflush(stderr); setIPCDeathHook(sendcommand_die);