From addd7dc21fe99f2701c1d4708071578052af401d Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 24 Jul 2016 17:54:31 +0200 Subject: [PATCH] block: best-effort in find_mount_point Don't immediatly fail if block device cannot be stat'ed. Signed-off-by: Daniel Golle --- block.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 3326458..720ecb1 100644 --- a/block.c +++ b/block.c @@ -592,13 +592,13 @@ static char* find_mount_point(char *block) int len = strlen(block); char *point = NULL, *pos, *tmp, *cpoint, *devname; struct stat s; + int rstat; unsigned int minor, major; if (!fp) return NULL; - if (stat(block, &s)) - return NULL; + rstat = stat(block, &s); while (fgets(line, sizeof(line), fp)) { pos = strchr(line, ' '); @@ -658,6 +658,9 @@ static char* find_mount_point(char *block) break; } + if (rstat) + continue; + if (!S_ISBLK(s.st_mode)) continue; -- 2.25.1