From: Andreas Schneider Date: Mon, 8 Jul 2024 09:24:34 +0000 (+0200) Subject: s3:modules: Move chunk out of the loop X-Git-Tag: tdb-1.4.11~126 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a541a7d7168fb5383764e7aee44c30a74172f68a;p=thirdparty%2Fsamba.git s3:modules: Move chunk out of the loop Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner --- diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c index 926f3ce3076..1e571569192 100644 --- a/source3/modules/vfs_preopen.c +++ b/source3/modules/vfs_preopen.c @@ -204,14 +204,13 @@ static bool preopen_helper_open_one(int sock_fd, char **pnamebuf, { char *namebuf = *pnamebuf; ssize_t nread; + ssize_t chunk; char c = 0; int fd; nread = 0; do { - ssize_t chunk; - chunk = read(sock_fd, namebuf + nread, talloc_get_size(namebuf) - nread); if (chunk <= 0) { @@ -235,7 +234,7 @@ static bool preopen_helper_open_one(int sock_fd, char **pnamebuf, if (fd == -1) { goto done; } - nread = read(fd, filebuf, to_read); + chunk = read(fd, filebuf, to_read); close(fd); done: