aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-01-06 06:42:05 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-01-06 06:42:05 +0000
commit8fc1ceb3e52898e46a0209f1e4a084376f8d46ce (patch)
treea7e19a64f2f0b59b064153499dbedebd5b9c7ae8
parentcc0f1aba257bc1344cc9d70b949560120256215e (diff)
downloadlcd4linux-8fc1ceb3e52898e46a0209f1e4a084376f8d46ce.tar.gz
initialize fifo on first use
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@942 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--plugin_fifo.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/plugin_fifo.c b/plugin_fifo.c
index f8be4c8..3a41e04 100644
--- a/plugin_fifo.c
+++ b/plugin_fifo.c
@@ -149,11 +149,37 @@ static int openFifo()
}
+static void startFifo(void)
+{
+ static int started = 0;
+
+ if (started)
+ return;
+
+ started = 1;
+
+ configure_fifo();
+ fd.path = fifopath;
+ fd.input = -1;
+ fd.created = 0;
+ openFifo();
+
+ /* ignore broken pipe */
+ signal(SIGPIPE, SIG_IGN);
+
+ memset(msg, 0, FIFO_BUFFER_SIZE);
+
+}
+
+
static void fiforead(RESULT * result)
{
char buf[FIFO_BUFFER_SIZE];
unsigned int i;
int bytes = 1;
+
+ startFifo();
+
memset(buf, 0, FIFO_BUFFER_SIZE);
strcat(buf, "ERROR");
@@ -184,18 +210,6 @@ static void fiforead(RESULT * result)
/* plugin initialization */
int plugin_init_fifo(void)
{
- configure_fifo();
- fd.path = fifopath;
- fd.input = -1;
- fd.created = 0;
- if (openFifo() < 0) {
- return -1;
- }
-
- /* ignore broken pipe */
- signal(SIGPIPE, SIG_IGN);
-
- memset(msg, 0, FIFO_BUFFER_SIZE);
AddFunction("fifo::read", 0, fiforead);
return 0;
}
@@ -203,7 +217,6 @@ int plugin_init_fifo(void)
void plugin_exit_fifo(void)
{
-
/* close filedescriptors */
closeFifo();
}
d>1-2/+3 2014-07-23Imported Upstream version 0+git20140611.14bd6c7upstream/0+git20140611.14bd6c7Jonathan McCrohan7-11/+60 2014-05-13New Upstream Snapshot (commit 1246b27)Jonathan McCrohan1-0/+6 2014-05-13Imported Upstream version 0+git20140512.1246b27upstream/0+git20140512.1246b27Jonathan McCrohan391-301/+3983 2014-04-05Release 0+git20140326.cfc2975-1debian/0+git20140326.cfc2975-1Jonathan McCrohan1-2/+2 2014-04-05d/control: update Homepage (upstream has moved from Gitweb to cgit)Jonathan McCrohan2-1/+2 2014-04-05New Upstream Snapshot (commit cfc2975)Jonathan McCrohan1-0/+6 2014-04-05Imported Upstream version 0+git20140326.cfc2975upstream/0+git20140326.cfc2975Jonathan McCrohan118-656/+877 2014-01-16Release 0+git20140107.1850cf8-1debian/0+git20140107.1850cf8-1Jonathan McCrohan1-2/+2 2014-01-16Update Standards Version to 3.9.5Jonathan McCrohan2-1/+9