busybox
Unused variable if MDEV_CONF && MDEV_RENAME && !MDEV_RENAME_REGEXP. The pointer variable *p is unused when MDEV_CONF and MDEV_RENAME are set and MDEV_RENAME_REGEXP is not defined.
Bug fixed by commit b62bd7b261b
| Type | UnusedVariable |
| Config | FEATURE_MDEV_CONF && FEATURE_MDEV_RENAME && !FEATURE_MDEV_RENAME_REGEXP (3rd degree) |
| C-features | PointerArithmetic |
| Fix-in | mapping |
| Location | util-linux/ |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void make_device()
{
#ifdef ENABLE_FEATURE_MDEV_CONF
#ifdef ENABLE_FEATURE_MDEV_RENAME
char *val;
char *s, *p;
val = "mode - device permissions";
char *a = val;
s = strchr(val, ' ');
val = (s && s[1]) ? s+1 : NULL;
#ifdef ENABLE_FEATURE_MDEV_RENAME_REGEXP
/* substitute %1..9 with off[1..9], if any */
int n = 0;
s = a;
while (*s) {
*p = *s;
if(rand() % 2) {
n++;
p += n - 1;
}
p++;
s++;
}
#endif
#endif /* ENABLE_FEATURE_MDEV_RENAME */
#endif
}
int main(int argc, char** argv)
{
if(rand() % 2)
make_device();
return 0;
}
diff --git a/simple/b62bd7b.c b/simple/b62bd7b.c --- a/simple/b62bd7b.c +++ b/simple/b62bd7b.c @@ -9,7 +9,10 @@ #ifdef ENABLE_FEATURE_MDEV_RENAME char *val; - char *s, *p; + char *s; +#ifdef ENABLE_FEATURE_MDEV_RENAME_REGEXP + char *p; +#endif val = "mode - device permissions"; char *a = val;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv)
{
if(rand() % 2) {
// make_device();
#ifdef ENABLE_FEATURE_MDEV_CONF
#ifdef ENABLE_FEATURE_MDEV_RENAME
char *val;
char *s, *p;
val = "mode - device permissions";
char *a = val;
s = strchr(val, ' ');
val = (s && s[1]) ? s+1 : NULL;
#ifdef ENABLE_FEATURE_MDEV_RENAME_REGEXP
/* substitute %1..9 with off[1..9], if any */
int n = 0;
s = a;
while (*s) {
*p = *s;
if(rand() % 2) {
n++;
p += n - 1;
}
p++;
s++;
}
#endif
#endif /* ENABLE_FEATURE_MDEV_RENAME */
#endif
}
return 0;
}