mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
t_stripealign: Fix fibmap error handling
FIBMAP only returns a negative value when the underlying filesystem does not support FIBMAP or on permission error. For the remaining errors, i.e. those usually returned from the filesystem itself, zero will be returned. We can not trust a zero return from the FIBMAP, and such behavior made generic/223 succeed when it should not. Also, we can't use perror() only to print errors when FIBMAP failed, or it will simply print 'success' when a zero is returned. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
committed by
Eryu Guan
parent
9cd2fe8a93
commit
c9adaa192f
+5
-2
@@ -76,8 +76,11 @@ int main(int argc, char ** argv)
|
||||
unsigned int bmap = 0;
|
||||
|
||||
ret = ioctl(fd, FIBMAP, &bmap);
|
||||
if (ret < 0) {
|
||||
perror("fibmap");
|
||||
if (ret <= 0) {
|
||||
if (ret < 0)
|
||||
perror("fibmap");
|
||||
else
|
||||
fprintf(stderr, "fibmap returned no result\n");
|
||||
free(fie);
|
||||
close(fd);
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user