[Toybox] [PATCH] mdev: browse /sys/block only if directory exists
Gaël PORTAY
gael.portay at savoirfairelinux.com
Sat Aug 26 16:19:18 PDT 2017
When the kernel block layer is disabled, mdev reports terminates in
error because it cannot browse /sys/block.
It reports the following message.
mdev: /sys/block: No such file or directory
---
toys/pending/mdev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/toys/pending/mdev.c b/toys/pending/mdev.c
index a270e52..cab56d3 100644
--- a/toys/pending/mdev.c
+++ b/toys/pending/mdev.c
@@ -223,10 +223,12 @@ static int callback(struct dirtree *node)
void mdev_main(void)
{
// Handle -s
+ struct stat st;
if (toys.optflags) {
dirtree_read("/sys/class", callback);
- dirtree_read("/sys/block", callback);
+ if (!stat("/sys/block", &st))
+ dirtree_read("/sys/block", callback);
} else { // hotplug support
make_device(NULL);
}
--
2.13.2
More information about the Toybox
mailing list