From 0f7a86c46ff90b907615d8f096f86c383ccf3e8e Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 7 Dec 2017 18:44:59 +0100 Subject: [PATCH] s3:vfs_preopen: Change to a do-while loop and fix the check This fixes compilation with -Wstrict-overflow=2 Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- source3/modules/vfs_preopen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c index aac00c7be958..b6a63d35b1e8 100644 --- a/source3/modules/vfs_preopen.c +++ b/source3/modules/vfs_preopen.c @@ -156,7 +156,7 @@ static bool preopen_helper_open_one(int sock_fd, char **pnamebuf, nread = 0; - while ((nread == 0) || (namebuf[nread-1] != '\0')) { + do { ssize_t thistime; thistime = read(sock_fd, namebuf + nread, @@ -176,7 +176,7 @@ static bool preopen_helper_open_one(int sock_fd, char **pnamebuf, } *pnamebuf = namebuf; } - } + } while (namebuf[nread - 1] != '\0'); fd = open(namebuf, O_RDONLY); if (fd == -1) { -- 2.34.1