From f0fe8ab50df992e2f0a9e8c49b2c43d161880d07 Mon Sep 17 00:00:00 2001 From: Yuriy Nazarov Date: Thu, 19 Jun 2014 03:12:22 +0400 Subject: [PATCH] lib/loopdev.c: reset errno before strtol() call Fixed unsuccessful attempt to find unused loop devices if 0-7 devices already used and /dev/loop directory exists. --- lib/loopdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/loopdev.c b/lib/loopdev.c index 988f3d337a..2488a6fdb0 100644 --- a/lib/loopdev.c +++ b/lib/loopdev.c @@ -458,6 +458,7 @@ static int loop_scandir(const char *dirname, int **ary, int hasprefix) /* /dev/loop/ */ char *end = NULL; + errno = 0; n = strtol(d->d_name, &end, 10); if (d->d_name == end || (end && *end) || errno) continue; -- 2.47.3