From 8c9892fea89f800089d450b719147fb70ed52c58 Mon Sep 17 00:00:00 2001 From: michux Date: Mon, 14 Apr 2008 10:47:21 +0000 Subject: minor update git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@875 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- plugin_fifo.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugin_fifo.c b/plugin_fifo.c index fc3f77f..59422e5 100644 --- a/plugin_fifo.c +++ b/plugin_fifo.c @@ -68,12 +68,15 @@ static char fifopath[1024]; static void configure_fifo(void) { char *s; + memset(fifopath, 0, 1024); s = cfg_get(Section, "fifopath", "/tmp/lcd4linux.fifo"); if (*s == '\0') { info("[FIFO] empty '%s.fifopath' entry from %s, assuming '/tmp/lcd4linux.fifo'", Section, cfg_source()); strcpy(fifopath, "/tmp/lcd4linux.fifo"); - } else + } else { strcpy(fifopath, s); + info("[FIFO] read '%s.fifopath', value is '%s'", Section, fifopath); + } free(s); } @@ -153,10 +156,12 @@ static void fiforead(RESULT * result) strcat(buf, "ERROR"); if (checkFifo() == 0) { memset(buf, 0, FIFO_BUFFER_SIZE); - while (bytes > 0 && errno != EINTR) + while (bytes > 0 && errno != EINTR) { bytes = read(fd.input, buf, FIFO_BUFFER_SIZE); + } + if (bytes < 0) { - error("[FIFO] Error %i: %s\n", errno, strerror(errno)); + error("[FIFO] Error %i: %s", errno, strerror(errno)); } else { if (strlen(buf) > 0) { strcpy(msg, buf); @@ -166,7 +171,7 @@ static void fiforead(RESULT * result) msg[i] = ' '; } } - } + } /* store result */ SetResult(&result, R_STRING, msg); -- cgit v1.2.3