busybox
Copiler warning about an unused variable if !FEATURE_REMOTE_LOG.
Bug fixed by commit 192c35f6eb2
Type | UnusedVariable |
Config | !FEATURE_REMOTE_LOG (1st degree) |
Fix-in | mapping |
Location | sysklogd/ |
#include <stdio.h> #include <string.h> void logMessage(char *msg) { static char line[512]; #ifdef CONFIG_FEATURE_REMOTE_LOG int remotefd = 1; if (remotefd) { memset(&line, 0, sizeof(line)); /* read the array elements, save them */ printf(line, sizeof(line), "<%s>", msg); } #endif } void doSyslogd(void) { logMessage("syslogd started"); } int main(int argc, char** argv) { doSyslogd(); return 0; }
diff --git a/simple/192c35f.c b/simple/192c35f.c --- a/simple/192c35f.c +++ b/simple/192c35f.c @@ -4,7 +4,9 @@ void logMessage(char *msg) { +#ifdef CONFIG_FEATURE_REMOTE_LOG static char line[512]; +#endif #ifdef CONFIG_FEATURE_REMOTE_LOG int remotefd = 1;
#include <stdio.h> #include <string.h> int main(int argc, char** argv) { // doSyslogd(); char *msg = "syslogd started"; static char line[512]; #ifdef CONFIG_FEATURE_REMOTE_LOG int remotefd = 1; if (remotefd) { memset(&line, 0, sizeof(line)); /* read the array elements, save them */ printf(line, sizeof(line), "<%s>", msg); } #endif return 0; }
. call sysklogd/syslogd.c:696:doSyslogd() .. 528:doSyslogd(); .. call sysklogd/syslogd.c:384:logMessage(int pri, char *msg) .. 581:logMessage(LOG_SYSLOG | LOG_INFO, "syslogd started: " BB_BANNER); ... [FEATURE_REMOTE_LOG] 421:memset(&line, 0, sizeof(line));