[PATCH] tst_security.sh: Fix bug in tst_disable_selinux()

Avinesh Kumar via ltp <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
  tst_disable_selinux() used "cat 0 > $f" which attempts to read a file
  named "0" instead of writing the value 0 to the enforce file. Replace
  with "echo 0 > $f" to correctly disable SELinux enforcing mode.

  Reported by ltp-agent [0]

[0] https://lore.kernel.org/ltp/20260615131754.3990-1-linuxtestproject.agent-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org/

Signed-off-by: Avinesh Kumar <avinesh.kumar-IBi9RG/[email protected]>
---
 testcases/lib/tst_security.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/lib/tst_security.sh b/testcases/lib/tst_security.sh
index 820736c72..ab1dff816 100644
--- a/testcases/lib/tst_security.sh
+++ b/testcases/lib/tst_security.sh
@@ -119,7 +119,7 @@ tst_disable_selinux()
 
 	local f="$(tst_get_enforce)"
 
-	[ -f "$f" ] && cat 0 > $f
+	[ -f "$f" ] && echo 0 > $f
 }
 
 # Get SELinux directory path
-- 
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.