]> 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)
committerStefan Metzmacher <metze@samba.org>
Thu, 14 May 2020 20:29:38 +0000 (20:29 +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>
source3/rpc_server/srvsvc/srv_srvsvc_nt.c

index c795dd2c6eb344c51446ab5c34f8bc898f075a7b..eae11bd4fc7abdf94deeb8753ecd80519ff8405e 100644 (file)
@@ -90,7 +90,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;
@@ -115,9 +114,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;
@@ -155,7 +154,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,