summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-08-23 13:06:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:37 -0500
commit312ded39cc08596fd3818ab81f25d2e9e09d7a3c (patch)
tree25cdec57aafe7c2e7446b7fff75ac390ef774a63 /source4/ntvfs/posix
parent09129c73d7b7fc97478fe642dc43f7e5ce9a2ba9 (diff)
downloadsamba-312ded39cc08596fd3818ab81f25d2e9e09d7a3c.tar.gz
samba-312ded39cc08596fd3818ab81f25d2e9e09d7a3c.tar.bz2
samba-312ded39cc08596fd3818ab81f25d2e9e09d7a3c.zip
r17752: using -1 in a uint16_t value causes compiler warnings,
use UINT16_MAX as invalid search handle metze (This used to be commit a4e19d6cc4cce611241c502de485dbd2496be0d3)
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r--source4/ntvfs/posix/pvfs_search.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source4/ntvfs/posix/pvfs_search.c b/source4/ntvfs/posix/pvfs_search.c
index 58cc1e04f3..0d6ee117b5 100644
--- a/source4/ntvfs/posix/pvfs_search.c
+++ b/source4/ntvfs/posix/pvfs_search.c
@@ -31,6 +31,8 @@
/* place a reasonable limit on old-style searches as clients tend to
not send search close requests */
#define MAX_OLD_SEARCHES 2000
+#define MAX_SEARCH_HANDLES (UINT16_MAX - 1)
+#define INVALID_SEARCH_HANDLE UINT16_MAX
/*
destroy an open search
@@ -58,7 +60,7 @@ static void pvfs_search_timer(struct event_context *ev, struct timed_event *te,
static void pvfs_search_setup_timer(struct pvfs_search_state *search)
{
struct event_context *ev = search->pvfs->ntvfs->ctx->event_ctx;
- if (search->handle == -1) return;
+ if (search->handle == INVALID_SEARCH_HANDLE) return;
talloc_free(search->te);
search->te = event_add_timed(ev, search,
timeval_current_ofs(search->pvfs->search.inactivity_time, 0),
@@ -488,7 +490,7 @@ static NTSTATUS pvfs_search_first_trans2(struct ntvfs_module_context *ntvfs,
return status;
}
- id = idr_get_new(pvfs->search.idtree, search, UINT16_MAX);
+ id = idr_get_new(pvfs->search.idtree, search, MAX_SEARCH_HANDLES);
if (id == -1) {
return NT_STATUS_INSUFFICIENT_RESOURCES;
}
@@ -669,7 +671,7 @@ static NTSTATUS pvfs_search_first_smb2(struct ntvfs_module_context *ntvfs,
NT_STATUS_NOT_OK_RETURN(status);
search->pvfs = pvfs;
- search->handle = -1;
+ search->handle = INVALID_SEARCH_HANDLE;
search->dir = dir;
search->current_index = 0;
search->search_attrib = 0;
@@ -804,7 +806,7 @@ NTSTATUS pvfs_search_close(struct ntvfs_module_context *ntvfs,
{
struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
- uint16_t handle = 0;
+ uint16_t handle = INVALID_SEARCH_HANDLE;
switch (io->generic.level) {
case RAW_FINDCLOSE_GENERIC: