summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--grammar/rainerscript.c6
-rw-r--r--plugins/omprog/omprog.c7
-rw-r--r--plugins/omstdout/omstdout.c8
-rw-r--r--runtime/debug.c8
4 files changed, 22 insertions, 7 deletions
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 0dc505a7..f7f09697 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -2794,7 +2794,8 @@ cnfDoInclude(char *name)
if(result == GLOB_NOSPACE || result == GLOB_ABORTED) {
char errStr[1024];
rs_strerror_r(errno, errStr, sizeof(errStr));
- getcwd(cwdBuf, sizeof(cwdBuf));
+ if(getcwd(cwdBuf, sizeof(cwdBuf)) == NULL)
+ strcpy(cwdBuf, "??getcwd() failed??");
parser_errmsg("error accessing config file or directory '%s' [cwd:%s]: %s",
finalName, cwdBuf, errStr);
return 1;
@@ -2805,7 +2806,8 @@ cnfDoInclude(char *name)
if(stat(cfgFile, &fileInfo) != 0) {
char errStr[1024];
rs_strerror_r(errno, errStr, sizeof(errStr));
- getcwd(cwdBuf, sizeof(cwdBuf));
+ if(getcwd(cwdBuf, sizeof(cwdBuf)) == NULL)
+ strcpy(cwdBuf, "??getcwd() failed??");
parser_errmsg("error accessing config file or directory '%s' "
"[cwd: %s]: %s", cfgFile, cwdBuf, errStr);
return 1;
diff --git a/plugins/omprog/omprog.c b/plugins/omprog/omprog.c
index 6978a9d0..e425b428 100644
--- a/plugins/omprog/omprog.c
+++ b/plugins/omprog/omprog.c
@@ -128,7 +128,12 @@ static void execBinary(instanceData *pData, int fdStdin)
assert(pData != NULL);
fclose(stdin);
- dup(fdStdin);
+ if(dup(fdStdin) == -1) {
+ DBGPRINTF("omprog: dup() failed\n");
+ /* do some more error handling here? Maybe if the module
+ * gets some more widespread use...
+ */
+ }
//fclose(stdout);
/* we close all file handles as we fork soon
diff --git a/plugins/omstdout/omstdout.c b/plugins/omstdout/omstdout.c
index 65818c27..59f9c8bb 100644
--- a/plugins/omstdout/omstdout.c
+++ b/plugins/omstdout/omstdout.c
@@ -136,9 +136,13 @@ CODESTARTdoAction
toWrite = (char*) ppString[0];
}
len = strlen(toWrite);
- write(1, toWrite, len); /* 1 is stdout! */
+ /* the following if's are just to silence compiler warnings. If someone
+ * actually intends to use this module in production (why???), this code
+ * needs to be more solid. -- rgerhards, 2012-11-28
+ */
+ if(write(1, toWrite, len)) {}; /* 1 is stdout! */
if(pData->bEnsureLFEnding && toWrite[len-1] != '\n') {
- write(1, "\n", 1); /* write missing LF */
+ if(write(1, "\n", 1)) {}; /* write missing LF */
}
ENDdoAction
diff --git a/runtime/debug.c b/runtime/debug.c
index 307a8bb8..1d306dbd 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -902,8 +902,12 @@ do_dbgprint(uchar *pszObjName, char *pszMsg, size_t lenMsg)
lenCopy = lenMsg;
memcpy(pszWriteBuf + offsWriteBuf, pszMsg, lenCopy);
offsWriteBuf += lenCopy;
- if(stddbg != -1) write(stddbg, pszWriteBuf, offsWriteBuf);
- if(altdbg != -1) write(altdbg, pszWriteBuf, offsWriteBuf);
+ /* the write is included in an "if" just to silence compiler
+ * warnings. Here, we really don't care if the write fails, we
+ * have no good response to that in any case... -- rgerhards, 2012-11-28
+ */
+ if(stddbg != -1) if(write(stddbg, pszWriteBuf, offsWriteBuf)){};
+ if(altdbg != -1) if(write(altdbg, pszWriteBuf, offsWriteBuf)){};
bWasNL = (pszMsg[lenMsg - 1] == '\n') ? 1 : 0;
}