]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/loopdev.c: reset errno before strtol() call
authorYuriy Nazarov <nazarov.yuriy.pavlovich@gmail.com>
Wed, 18 Jun 2014 23:12:22 +0000 (03:12 +0400)
committerYuriy Nazarov <nazarov.yuriy.pavlovich@gmail.com>
Wed, 18 Jun 2014 23:12:22 +0000 (03:12 +0400)
Fixed unsuccessful attempt to find unused loop devices if 0-7
devices already used and /dev/loop directory exists.

lib/loopdev.c

index 988f3d337aefa40a4ee81521a6f71c2ccd9c657e..2488a6fdb099c3d5d120505c3338f564b252f538 100644 (file)
@@ -458,6 +458,7 @@ static int loop_scandir(const char *dirname, int **ary, int hasprefix)
                        /* /dev/loop/<N> */
                        char *end = NULL;
 
+                       errno = 0;
                        n = strtol(d->d_name, &end, 10);
                        if (d->d_name == end || (end && *end) || errno)
                                continue;