diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-03-05 14:00:40 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2014-04-01 09:08:06 +0200 |
commit | 03f9c6123ac5c283c4933cd292c68ea55b6b27c1 (patch) | |
tree | f43615cb425a160e24b85727a857552412d9c34e /source3 | |
parent | 00a60edb2ecea5c9d98ef1010f403d05842a1dc0 (diff) | |
download | samba-03f9c6123ac5c283c4933cd292c68ea55b6b27c1.tar.gz |
s3:smbd: simplify maxentries calculation in reply_search()
Using helper variables make it much easier to understand.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 734e1b65044a33eba01b41695502c2257c1a4d9e)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/reply.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 91561256589..2dea74daf63 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1697,11 +1697,10 @@ void reply_search(struct smb_request *req) } } else { unsigned int i; - maxentries = MIN( - maxentries, - ((BUFFER_SIZE - - ((uint8 *)smb_buf(req->outbuf) + 3 - req->outbuf)) - /DIR_STRUCT_SIZE)); + size_t hdr_size = ((uint8_t *)smb_buf(req->outbuf) + 3 - req->outbuf); + size_t available_space = BUFFER_SIZE - hdr_size; + + maxentries = MIN(maxentries, available_space/DIR_STRUCT_SIZE); DEBUG(8,("dirpath=<%s> dontdescend=<%s>\n", directory,lp_dontdescend(ctx, SNUM(conn)))); |