diff options
Diffstat (limited to 'lib/loopdev.c')
| -rw-r--r-- | lib/loopdev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/loopdev.c b/lib/loopdev.c index 81b7d2d6ec..de227e2265 100644 --- a/lib/loopdev.c +++ b/lib/loopdev.c @@ -369,9 +369,10 @@ static int loop_scandir(const char *dirname, int **ary, int hasprefix) } *ary = tmp; } - (*ary)[count++] = n; + if (*ary) + (*ary)[count++] = n; } - if (count) + if (count && *ary) qsort(*ary, count, sizeof(int), cmpnum); closedir(dir); |
