]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:modules: Move chunk out of the loop
authorAndreas Schneider <asn@samba.org>
Mon, 8 Jul 2024 09:24:34 +0000 (11:24 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 16 Jul 2024 11:41:33 +0000 (11:41 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/modules/vfs_preopen.c

index 926f3ce3076108d1120483b872e0b77289a5c204..1e5715691920ed4c2dd91985ff59fa8b8d277262 100644 (file)
@@ -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: