]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
srvsvc: Directly use "ctr3->count" instead of "i"
authorVolker Lendecke <vl@samba.org>
Tue, 21 Apr 2020 12:24:48 +0000 (14:24 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 6 Aug 2020 13:32:39 +0000 (13:32 +0000)
To me this was not very transparent, and now that we have "ctr3" a
single indirect looks okay

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14355

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 96d68bb9f26a0c99d00e92130a2f2c91c7b985e2)

source3/rpc_server/srvsvc/srv_srvsvc_nt.c

index b81de3d2b9ecc1873c8289f81b6ebe1fce5e6dab..a24ea63862474ca61fb36a83278bde457f8a68ad 100644 (file)
@@ -89,7 +89,6 @@ static int enum_file_fn(struct file_id id,
                (struct file_enum_count *)private_data;
        struct srvsvc_NetFileCtr3 *ctr3 = fenum->ctr3;
        struct srvsvc_NetFileInfo3 *f;
-       int i = ctr3->count;
        files_struct fsp;
        struct byte_range_lock *brl;
        int num_locks = 0;
@@ -114,9 +113,9 @@ static int enum_file_fn(struct file_id id,
                fenum->ctx,
                ctr3->array,
                struct srvsvc_NetFileInfo3,
-               i+1);
+               ctr3->count+1);
        if ( !f ) {
-               DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
+               DBG_ERR("realloc failed for %"PRIu32" items\n", ctr3->count+1);
                return 0;
        }
        ctr3->array = f;
@@ -154,7 +153,7 @@ static int enum_file_fn(struct file_id id,
 
        /* now fill in the srvsvc_NetFileInfo3 struct */
 
-       ctr3->array[i] = (struct srvsvc_NetFileInfo3) {
+       ctr3->array[ctr3->count] = (struct srvsvc_NetFileInfo3) {
                .fid            = (((uint32_t)(procid_to_pid(&e->pid))<<16) |
                                   e->share_file_id),
                .permissions    = permissions,