X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fsendcommand.c;h=9b331cc2456d44df78ab9ad3932d367a80608c19;hp=c7439dc0dbca681423020307810a64c8ff905f56;hb=c1cf1c8630e59eab79e4eea45ed82a5f71edd0d4;hpb=0539f37258bd65a5069e5026e03382652cdd50d3 diff --git a/citadel/sendcommand.c b/citadel/sendcommand.c index c7439dc0d..9b331cc24 100644 --- a/citadel/sendcommand.c +++ b/citadel/sendcommand.c @@ -77,12 +77,40 @@ void nq_cleanup(int e) exit(e); } +/* + * send binary to server + */ +void serv_write(CtdlIPC *ipc, const char *buf, unsigned int nbytes) +{ + unsigned int bytes_written = 0; + int retval; +/* +#if defined(HAVE_OPENSSL) + if (ipc->ssl) { + serv_write_ssl(ipc, buf, nbytes); + return; + } +#endif +*/ + while (bytes_written < nbytes) { + retval = write(ipc->sock, &buf[bytes_written], + nbytes - bytes_written); + if (retval < 1) { + connection_died(ipc, 0); + return; + } + bytes_written += retval; + } +} + + void cleanup(int e) { static int nested = 0; alarm(30); signal(SIGALRM, nq_cleanup); + serv_write(ipc, "\n", 1); if (nested++ < 1) CtdlIPCQuit(ipc); nq_cleanup(e);