Skip to contentSkip to conversation

selftests: netfilter: fix nft_audit.sh auditd detection

PATCH New Jin Li 1 participant 1 message Sep 11

Subsystems (3)
lore
Share & tools
lore

Jin Li

author
#0 lore raw

PATCH 1/1 selftests: netfilter: fix nft_audit.sh auditd detection

The auditd PID file location changed from /var/run/auditd.pid to /run/audit/auditd.pid in newer audit-userspace versions, causing the skip check in nft_audit.sh to fail silently.

Replace the PID file check with pgrep, which works regardless of where the PID file is located.

---
 tools/testing/selftests/net/netfilter/nft_audit.sh | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
tools/testing/selftests/net/netfilter/nft_audit.sh +3 -8
index 87f2b4c725aa..85cc4ce7742a 100755
@@ -6,14 +6,9 @@
 SKIP_RC=4
 RC=0
 
-if [ -r /var/run/auditd.pid ];then
-	read pid < /var/run/auditd.pid
-	p=$(pgrep ^auditd$)
-
-	if [ "$pid" -eq "$p" ]; then
-		echo "SKIP: auditd is running"
-		exit $SKIP_RC
-	fi
+if pgrep -x auditd > /dev/null; then
+	echo "SKIP: auditd is running"
+	exit $SKIP_RC
 fi
 
 nft --version >/dev/null 2>&1 || {
Signature · 1 line
2.53.0