Skip . and .. in foreach_bridge test
If bridge is name 'bridge' then the test for ./bridge would succeed
and eventually cause a SEGV. Correct fix is to just skip . directories
in scan.
diff --git a/libbridge/libbridge_init.c b/libbridge/libbridge_init.c
index a7473bd..1c1acbd 100644
--- a/libbridge/libbridge_init.c
+++ b/libbridge/libbridge_init.c
@@ -49,7 +49,11 @@
char path[SYSFS_PATH_MAX];
struct stat st;
- snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/bridge", entry->d_name);
+ if (entry->d_name[0] == '.')
+ return 0;
+
+ snprintf(path, SYSFS_PATH_MAX,
+ SYSFS_CLASS_NET "%s/bridge", entry->d_name);
return stat(path, &st) == 0 && S_ISDIR(st.st_mode);
}