Re: [PATCH 1/2] btrfs-progs: move out print in cmd_df to another function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 13, 2013 at 07:32:22PM +0800, Anand Jain wrote:
> +static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
> +{

This function returns full error codes, that's ok,

> @@ -77,89 +98,79 @@ static int cmd_df(int argc, char **argv)
>  	ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, sargs);
>  	e = errno;
>  	if (ret) {
> -		fprintf(stderr, "ERROR: couldn't get space info on '%s' - %s\n",
> -			path, strerror(e));
> -		goto out;
> +		fprintf(stderr, "ERROR: couldn't get space info - %s\n",
> +			strerror(e));
> +		free(sargs);
> +		return ret;

cmd_df should return the 0-1 normalized value after the cleanup that
Wang Shilong has done. You can leave the common exit block (ie. goto +
free/return as before) and use return !!ret.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux