diff mbox

[03/11] atomicio: removed a warning

Message ID 20170719205354.10006-4-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson July 19, 2017, 8:53 p.m. UTC
atomicio.c:43:7: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 support/nfs/atomicio.c | 1 +
 1 file changed, 1 insertion(+)

Comments

J. Bruce Fields July 20, 2017, 6:24 p.m. UTC | #1
On Wed, Jul 19, 2017 at 04:53:46PM -0400, Steve Dickson wrote:
> atomicio.c:43:7: warning: this statement may fall through [-Wimplicit-fallthrough=]

I think this is wrong.  For example, if we don't have permission to do
the IO, this causes atomicio() to return 0 instead of -1.

--b.

> 
> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
>  support/nfs/atomicio.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/support/nfs/atomicio.c b/support/nfs/atomicio.c
> index 5e760e6..0234072 100644
> --- a/support/nfs/atomicio.c
> +++ b/support/nfs/atomicio.c
> @@ -42,6 +42,7 @@ ssize_t atomicio(ssize_t(*f) (int, void *, size_t), int fd, void *_s, size_t n)
>  		case -1:
>  			if (errno == EINTR || errno == EAGAIN)
>  				continue;
> +			break;
>  		case 0:
>  			if (pos != 0)
>  				return pos;
> -- 
> 2.13.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Dickson July 21, 2017, 2:45 p.m. UTC | #2
On 07/20/2017 02:24 PM, J. Bruce Fields wrote:
> On Wed, Jul 19, 2017 at 04:53:46PM -0400, Steve Dickson wrote:
>> atomicio.c:43:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> I think this is wrong.  For example, if we don't have permission to do
> the IO, this causes atomicio() to return 0 instead of -1.
I see your point... Nice catch!

steved.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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/support/nfs/atomicio.c b/support/nfs/atomicio.c
index 5e760e6..0234072 100644
--- a/support/nfs/atomicio.c
+++ b/support/nfs/atomicio.c
@@ -42,6 +42,7 @@  ssize_t atomicio(ssize_t(*f) (int, void *, size_t), int fd, void *_s, size_t n)
 		case -1:
 			if (errno == EINTR || errno == EAGAIN)
 				continue;
+			break;
 		case 0:
 			if (pos != 0)
 				return pos;