From 9e4ea761055429185b7c76cf4c96ef5407fa7e83 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 14 May 2008 14:10:26 -0700 Subject: [PATCH] Ensure we don't keep searching for sharename if it's not the start of the list. Jeremy. --- source/smbd/conn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/smbd/conn.c b/source/smbd/conn.c index bd1f49032b9..ed8bdefe2e1 100644 --- a/source/smbd/conn.c +++ b/source/smbd/conn.c @@ -91,12 +91,12 @@ connection_struct *conn_find(unsigned cnum) connection_struct *conn_find_byname(const char *service) { - int count=0; connection_struct *conn; - for (conn=Connections;conn;conn=conn->next,count++) { + for (conn=Connections;conn;conn=conn->next) { if (strequal(lp_servicename(SNUM(conn)),service)) { - if (count > 10) { + if (conn != Connections) { + /* Promote if not first. */ DLIST_PROMOTE(Connections, conn); } return conn; -- 2.11.4.GIT