MINOR: vars: Move UPDATEONLY flag test to vars_set_ifexist

The vars_set_by_name_ifexist function was created to avoid creating too
many variables from a LUA module. This was made thanks to the
VF_UPDATEONLY flags which prevented variable creation in the var_set
function. Since commit 3a4bedccc ("MEDIUM: vars: replace the global name
index with a hash") this limitation was restricted to 'proc' scope
variables only.
This patch simply moves the scope test to the vars_set_by_name_ifexist
function instead of the var_set function.
diff --git a/src/vars.c b/src/vars.c
index f96bb27..4c5f88b 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -310,8 +310,7 @@
  * a bool (which is memory-less).
  *
  * Flags is a bitfield that may contain one of the following flags:
- *   - VF_UPDATEONLY: if the scope is SCOPE_PROC, the variable may only be
- *     updated but not created.
+ *   - VF_UPDATEONLY: the variable may only be updated but not created.
  *   - VF_CREATEONLY: do nothing if the variable already exists (success).
  *   - VF_PERMANENT: this flag will be passed to the variable upon creation
  *
@@ -351,8 +350,7 @@
 					    -var->data.u.meth.str.data);
 		}
 	} else {
-		/* creation permitted for proc ? */
-		if (flags & VF_UPDATEONLY && scope == SCOPE_PROC)
+		if (flags & VF_UPDATEONLY)
 			goto unlock;
 
 		/* Check memory available. */
@@ -502,7 +500,8 @@
 	return 1;
 }
 
-/* This function stores a sample in a variable if it was already defined.
+/* This function stores a sample in a variable unless it is of type "proc" and
+ * not defined yet.
  * Returns zero on failure and non-zero otherwise. The variable not being
  * defined is treated as a failure.
  */
@@ -515,7 +514,8 @@
 	if (!vars_hash_name(name, len, &scope, &hash, NULL))
 		return 0;
 
-	return var_set(hash, scope, smp, VF_UPDATEONLY);
+	/* Variable creation is allowed for all scopes apart from the PROC one. */
+	return var_set(hash, scope, smp, (scope == SCOPE_PROC) ? VF_UPDATEONLY : 0);
 }