diff options
author | michux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2008-04-14 10:47:21 +0000 |
---|---|---|
committer | michux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2008-04-14 10:47:21 +0000 |
commit | 8c9892fea89f800089d450b719147fb70ed52c58 (patch) | |
tree | d8125f3427a9533ddc91b71603f1c06f72b5f954 | |
parent | 2fe13717ddb620ef7e8d1244a5565e75ce1cd060 (diff) | |
download | lcd4linux-8c9892fea89f800089d450b719147fb70ed52c58.tar.gz |
minor update
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@875 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r-- | plugin_fifo.c | 13 |
1 files 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); |