diff mbox

[04/16] btrfs-progs: fix test for return of realpath in find_mount_root()

Message ID 1383779755-18228-5-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
find_mount_root() tries to test for realpath() failure, but
tests the wrong value.  Fix it.

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

Comments

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


On 11/07/2013 07:15 AM, Eric Sandeen wrote:
> find_mount_root() tries to test for realpath() failure, but
> tests the wrong value.  Fix it.
>
> Resolves-Coverity-CID: 1125940
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>   cmds-send.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/cmds-send.c b/cmds-send.c
> index 39110e7..53e9a53 100644
> --- a/cmds-send.c
> +++ b/cmds-send.c
> @@ -98,7 +98,7 @@ int find_mount_root(const char *path, char **mount_root)
>
>   	ret = 0;
>   	*mount_root = realpath(longest_match, NULL);
> -	if (!mount_root)
> +	if (!*mount_root)
>   		ret = -errno;
>
>   	free(longest_match);
>
--
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-send.c b/cmds-send.c
index 39110e7..53e9a53 100644
--- a/cmds-send.c
+++ b/cmds-send.c
@@ -98,7 +98,7 @@  int find_mount_root(const char *path, char **mount_root)
 
 	ret = 0;
 	*mount_root = realpath(longest_match, NULL);
-	if (!mount_root)
+	if (!*mount_root)
 		ret = -errno;
 
 	free(longest_match);