s3:param: avoid the use the global variable iServiceIndex in handle_copy
authorGarming Sam <garming@catalyst.net.nz>
Wed, 19 Feb 2014 00:53:53 +0000 (13:53 +1300)
committerJeremy Allison <jra@samba.org>
Wed, 7 May 2014 17:49:15 +0000 (19:49 +0200)
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/param/loadparm.c

index ddf8f45ef62e525755cbbfdecc1baf95fdaaa407..11b148625243902f83e92b15e9225bb376a3c0f2 100644 (file)
@@ -2641,13 +2641,13 @@ static bool handle_copy(struct loadparm_context *unused, int snum, const char *p
        DEBUG(3, ("Copying service from service %s\n", pszParmValue));
 
        if ((iTemp = getservicebyname(pszParmValue, NULL)) >= 0) {
-               if (iTemp == iServiceIndex) {
+               if (iTemp == snum) {
                        DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
                } else {
-                       copy_service(ServicePtrs[iServiceIndex],
-                                    ServicePtrs[iTemp],
-                                    ServicePtrs[iServiceIndex]->copymap);
-                       string_set(ServicePtrs[iServiceIndex], ptr, pszParmValue);
+                       copy_service(ServicePtrs[snum],
+                                    serviceTemp,
+                                    ServicePtrs[snum]->copymap);
+                       string_set(ServicePtrs[snum], ptr, pszParmValue);
                        bRetval = true;
                }
        } else {