X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Futils%2Fsendcommand.c;h=e562602af3b5bf28494e3b2cd7ea3a4e9c28d398;hb=6433ed0a9e2d0b4f6c97342ba31ba77b7c364c50;hp=097a9034b93b276e6e3da007cfafbcd7b0943308;hpb=182f984f6f03067f40a7e01bfa82df95f5605358;p=citadel.git diff --git a/citadel/utils/sendcommand.c b/citadel/utils/sendcommand.c index 097a9034b..e562602af 100644 --- a/citadel/utils/sendcommand.c +++ b/citadel/utils/sendcommand.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * Command-line utility to transmit a server command. * * Copyright (c) 1987-2010 by the citadel.org team @@ -51,36 +49,8 @@ #include "server.h" #include "config.h" -#define LOCKFILE "/tmp/LCK.sendcommand" - static CtdlIPC *ipc = NULL; -/* - * make sure only one copy of sendcommand runs at a time, using lock files - */ -int set_lockfile(void) -{ - FILE *lfp; - int onppid; - int rv; - - if ((lfp = fopen(LOCKFILE, "r")) != NULL) { - rv = fscanf(lfp, "%d", &onppid); - fclose(lfp); - if (!kill(onppid, 0) || errno == EPERM) - return 1; - } - lfp = fopen(LOCKFILE, "w"); - fprintf(lfp, "%ld\n", (long) getpid()); - fclose(lfp); - return (0); -} - -void remove_lockfile(void) -{ - unlink(LOCKFILE); -} - /* * Why both cleanup() and nq_cleanup() ? Notice the alarm() call in * cleanup() . If for some reason sendcommand hangs waiting for the server @@ -92,7 +62,6 @@ void nq_cleanup(int e) { if (e == SIGALRM) fprintf(stderr, "\nWatch dog time out.\n"); - remove_lockfile(); exit(e); } @@ -291,7 +260,7 @@ int main(int argc, char **argv) n = read(ipc->sock, rbuf, SIZ); if (n>0) { rbuf[n]='\0'; - fprintf(stderr, rbuf); + fprintf(stderr, "%s", rbuf); fflush (stdout); } }