Blame SOURCES/openscap-1.3.4-fix-environmentvariable58-regression.patch

4def80
diff --git a/src/OVAL/probes/independent/environmentvariable58_probe.c b/src/OVAL/probes/independent/environmentvariable58_probe.c
4def80
index 552ce6700..77233aeeb 100644
4def80
--- a/src/OVAL/probes/independent/environmentvariable58_probe.c
4def80
+++ b/src/OVAL/probes/independent/environmentvariable58_probe.c
4def80
@@ -96,32 +96,32 @@ static int read_environment(SEXP_t *pid_ent, SEXP_t *name_ent, probe_ctx *ctx)
4def80
 	ssize_t buffer_used;
4def80
 	size_t buffer_size;
4def80
 
4def80
+	const char *extra_vars = getenv("OSCAP_CONTAINER_VARS");
4def80
+	if (extra_vars && *extra_vars) {
4def80
+		char *vars = strdup(extra_vars);
4def80
+		char *tok, *eq_chr, *str, *strp;
4def80
+
4def80
+		for (str = vars; ; str = NULL) {
4def80
+			tok = strtok_r(str, "\n", &strp;;
4def80
+			if (tok == NULL)
4def80
+				break;
4def80
+			eq_chr = strchr(tok, '=');
4def80
+			if (eq_chr == NULL)
4def80
+				continue;
4def80
+			PROBE_ENT_I32VAL(pid_ent, pid, pid = -1;, pid = 0;);
4def80
+			collect_variable(tok, eq_chr - tok, pid, name_ent, ctx);
4def80
+		}
4def80
+
4def80
+		free(vars);
4def80
+		return 0;
4def80
+	}
4def80
+
4def80
 	const char *prefix = getenv("OSCAP_PROBE_ROOT");
4def80
 	snprintf(path, PATH_MAX, "%s/proc", prefix ? prefix : "");
4def80
 	d = opendir(path);
4def80
 	if (d == NULL) {
4def80
-		const char *extra_vars = getenv("OSCAP_CONTAINER_VARS");
4def80
-		if (!extra_vars) {
4def80
-			dE("Can't read %s/proc: errno=%d, %s.", prefix ? prefix : "", errno, strerror(errno));
4def80
-			return PROBE_EACCESS;
4def80
-		} else {
4def80
-			char *vars = strdup(extra_vars);
4def80
-			char *tok, *eq_chr, *str, *strp;
4def80
-
4def80
-			for (str = vars; ; str = NULL) {
4def80
-				tok = strtok_r(str, "\n", &strp;;
4def80
-				if (tok == NULL)
4def80
-					break;
4def80
-				eq_chr = strchr(tok, '=');
4def80
-				if (eq_chr == NULL)
4def80
-					continue;
4def80
-				PROBE_ENT_I32VAL(pid_ent, pid, pid = -1;, pid = 0;);
4def80
-				collect_variable(tok, eq_chr - tok, pid, name_ent, ctx);
4def80
-			}
4def80
-
4def80
-			free(vars);
4def80
-			return 0;
4def80
-		}
4def80
+		dE("Can't read %s/proc: errno=%d, %s.", prefix ? prefix : "", errno, strerror(errno));
4def80
+		return PROBE_EACCESS;
4def80
 	}
4def80
 
4def80
 	if ((buffer = realloc(NULL, BUFFER_SIZE)) == NULL) {