diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-09-11 16:10:17 +0200 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-09-13 17:36:59 +0200 |
commit | 372f37626513b29f18f8f31e892abea7d1d68917 (patch) | |
tree | 6164509f0baef0346a6822f8632cb61505d8d9a8 | |
parent | d2d0268b167c6f2cca85aa45f757b436c58a747d (diff) | |
download | unitd-372f37626513b29f18f8f31e892abea7d1d68917.tar unitd-372f37626513b29f18f8f31e892abea7d1d68917.zip |
udevtrigger: simplify scan_class function
Remove the local directory scanning code and
use the scan_subdir function instead.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-rw-r--r-- | udevtrigger.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/udevtrigger.c b/udevtrigger.c index 423df6a..2fb0e68 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -239,29 +239,10 @@ static void scan_block(void) static void scan_class(void) { char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; strlcpy(base, "/sys/class", sizeof(base)); - dir = opendir(base); - if (dir == NULL) - return; - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; - - if (dent->d_name[0] == '.') - continue; - - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); - - scan_subdir(dirname, NULL, true, 0); - } - - closedir(dir); + scan_subdir("/sys/class", NULL, false, 1); } int main(int argc, char *argv[], char *envp[]) |