remove_devices(): readlink returns -1 on error

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Jes Sorensen 2011-11-01 16:09:21 +01:00 committed by NeilBrown
parent 93f1df3355
commit d9ca03e9c3
1 changed files with 1 additions and 1 deletions

View File

@ -156,7 +156,7 @@ static void remove_devices(int devnum, char *path)
sprintf(pe, "%d", part);
}
n = readlink(path2, link, sizeof(link));
if (n && (int)strlen(base) == n &&
if (n > 0 && (int)strlen(base) == n &&
strncmp(link, base, n) == 0)
unlink(path2);
}