summaryrefslogtreecommitdiffstats
path: root/lib/loopdev.c
diff options
context:
space:
mode:
authorYuriy Nazarov2014-06-19 01:12:22 +0200
committerYuriy Nazarov2014-06-19 01:12:22 +0200
commitf0fe8ab50df992e2f0a9e8c49b2c43d161880d07 (patch)
tree4ba44ed0db83b1702e3581dc1659c6cb4c0dfb15 /lib/loopdev.c
parentbuild-sys: add libsmartcols to ko-release-gen script (diff)
downloadkernel-qcow2-util-linux-f0fe8ab50df992e2f0a9e8c49b2c43d161880d07.tar.gz
kernel-qcow2-util-linux-f0fe8ab50df992e2f0a9e8c49b2c43d161880d07.tar.xz
kernel-qcow2-util-linux-f0fe8ab50df992e2f0a9e8c49b2c43d161880d07.zip
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.
Diffstat (limited to 'lib/loopdev.c')
-rw-r--r--lib/loopdev.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/loopdev.c b/lib/loopdev.c
index 988f3d337..2488a6fdb 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/<N> */
char *end = NULL;
+ errno = 0;
n = strtol(d->d_name, &end, 10);
if (d->d_name == end || (end && *end) || errno)
continue;