get_df returns -ERRNO, or maybe (+)errno, or even 0 in
the case where we inexplicably got 0 total_spaces from
the BTRFS_IOC_SPACE_INFO.
Consistently return a negative error number, and return
-ENOENT rather than 0 for total_spaces == 0, so that the
caller will know that **sargs_ret hasn't been set up.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fprintf(stderr, "ERROR: couldn't get space info - %s\n",
strerror(e));
free(sargs);
- return ret;
+ return -e;
}
+ /* This really should never happen */
if (!sargs->total_spaces) {
free(sargs);
- return 0;
+ return -ENOENT;
}
count = sargs->total_spaces;
free(sargs);
fprintf(stderr, "ERROR: get space info count %llu - %s\n",
count, strerror(e));
free(sargs);
- return ret;
+ return -e;
}
*sargs_ret = sargs;
return 0;