diff mbox

[11/16] btrfs-progs: pass positive errno to strerror in cmd_df()

Message ID 1383779755-18228-12-git-send-email-sandeen@redhat.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Eric Sandeen Nov. 6, 2013, 11:15 p.m. UTC
get_df returns a negative error number, but then
we pass it to strerror, which wants a positive value...

Resolves-Coverity-CID: 1125929
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 cmds-filesystem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Anand Jain Nov. 7, 2013, 4:43 a.m. UTC | #1
Reviewed-by Anand Jain <anand.jain@oracle.com>

On 11/07/2013 07:15 AM, Eric Sandeen wrote:
> get_df returns a negative error number, but then
> we pass it to strerror, which wants a positive value...
>
> Resolves-Coverity-CID: 1125929
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>   cmds-filesystem.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/cmds-filesystem.c b/cmds-filesystem.c
> index df9d1ff..b1291d6 100644
> --- a/cmds-filesystem.c
> +++ b/cmds-filesystem.c
> @@ -173,7 +173,7 @@ static int cmd_df(int argc, char **argv)
>   		print_df(sargs);
>   		free(sargs);
>   	} else {
> -		fprintf(stderr, "ERROR: get_df failed %s\n", strerror(ret));
> +		fprintf(stderr, "ERROR: get_df failed %s\n", strerror(-ret));
>   	}
>
>   	close_file_or_dir(fd, dirstream);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index df9d1ff..b1291d6 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -173,7 +173,7 @@  static int cmd_df(int argc, char **argv)
 		print_df(sargs);
 		free(sargs);
 	} else {
-		fprintf(stderr, "ERROR: get_df failed %s\n", strerror(ret));
+		fprintf(stderr, "ERROR: get_df failed %s\n", strerror(-ret));
 	}
 
 	close_file_or_dir(fd, dirstream);