xfs_repair: fix incorrect return value in namecheck()
diff mbox series

Message ID f17672e5-63eb-0f74-afdf-55ff006ee28d@redhat.com
State Accepted
Headers show
Series
  • xfs_repair: fix incorrect return value in namecheck()
Related show

Commit Message

Eric Sandeen Jan. 31, 2019, 8:20 p.m. UTC
Obviously a directory entry with a '/' in the name should return
1, i.e. failure.  This was just a dumb thinko.

Fixes: 45571fd5885d ("xfs_repair: allow '/' in attribute names")

Reported-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Comments

Darrick J. Wong Jan. 31, 2019, 8:40 p.m. UTC | #1
On Thu, Jan 31, 2019 at 02:20:58PM -0600, Eric Sandeen wrote:
> Obviously a directory entry with a '/' in the name should return
> 1, i.e. failure.  This was just a dumb thinko.
> 
> Fixes: 45571fd5885d ("xfs_repair: allow '/' in attribute names")
> 
> Reported-by: Darrick J. Wong <darrick.wong@oracle.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

(Sez me who complained about this weeks ago on IRC and then RVBd the
broken version so who knows where my brain went lunchtime lol...)

--D

> ---
> 
> diff --git a/repair/da_util.c b/repair/da_util.c
> index c5e690c..4a258e5 100644
> --- a/repair/da_util.c
> +++ b/repair/da_util.c
> @@ -31,7 +31,7 @@ namecheck(
>  
>  	for (c = name, i = 0; i < length; i++, c++) {
>  		if (isadir && *c == '/')
> -			return 0;
> +			return 1;
>  		if (*c == '\0')
>  			return 1;
>  	}
>
Bill O'Donnell Jan. 31, 2019, 8:47 p.m. UTC | #2
On Thu, Jan 31, 2019 at 02:20:58PM -0600, Eric Sandeen wrote:
> Obviously a directory entry with a '/' in the name should return
> 1, i.e. failure.  This was just a dumb thinko.
> 
> Fixes: 45571fd5885d ("xfs_repair: allow '/' in attribute names")
> 
> Reported-by: Darrick J. Wong <darrick.wong@oracle.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---

Makes sense.
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
> 
> diff --git a/repair/da_util.c b/repair/da_util.c
> index c5e690c..4a258e5 100644
> --- a/repair/da_util.c
> +++ b/repair/da_util.c
> @@ -31,7 +31,7 @@ namecheck(
>  
>  	for (c = name, i = 0; i < length; i++, c++) {
>  		if (isadir && *c == '/')
> -			return 0;
> +			return 1;
>  		if (*c == '\0')
>  			return 1;
>  	}
>

Patch
diff mbox series

diff --git a/repair/da_util.c b/repair/da_util.c
index c5e690c..4a258e5 100644
--- a/repair/da_util.c
+++ b/repair/da_util.c
@@ -31,7 +31,7 @@  namecheck(
 
 	for (c = name, i = 0; i < length; i++, c++) {
 		if (isadir && *c == '/')
-			return 0;
+			return 1;
 		if (*c == '\0')
 			return 1;
 	}