39 строки
1.1 KiB
Diff
39 строки
1.1 KiB
Diff
|
From 578a65904ff6426c01d81826873d27d0af35f355 Mon Sep 17 00:00:00 2001
|
||
|
From: Paul Moore <paul@paul-moore.com>
|
||
|
Date: Sun, 17 Mar 2019 17:13:55 -0400
|
||
|
Subject: [PATCH] netlabel_config: better error reporting on load
|
||
|
|
||
|
Signed-off-by: Paul Moore <paul@paul-moore.com>
|
||
|
---
|
||
|
netlabelctl/netlabel-config | 10 ++++++++--
|
||
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/netlabelctl/netlabel-config b/netlabelctl/netlabel-config
|
||
|
index 717d795..15c74f7 100755
|
||
|
--- a/netlabelctl/netlabel-config
|
||
|
+++ b/netlabelctl/netlabel-config
|
||
|
@@ -114,15 +114,21 @@ function nlbl_reset() {
|
||
|
# load the NetLabel configuration from the configuration file
|
||
|
function nlbl_load() {
|
||
|
local ret_rc=0
|
||
|
+ local line_num=0
|
||
|
local line
|
||
|
while read line; do
|
||
|
+ line_num=$(($line_num + 1))
|
||
|
# skip comments and blank lines
|
||
|
echo "$line" | egrep '^#|^$' >& /dev/null && continue
|
||
|
|
||
|
# perform the configuration
|
||
|
- netlabelctl $line >& /dev/null
|
||
|
+ output=$(netlabelctl $line 2>&1)
|
||
|
rc=$?
|
||
|
- [[ $rc -ne 0 ]] && ret_rc=1
|
||
|
+ if [[ $rc -ne 0 ]]; then
|
||
|
+ ret_rc=1
|
||
|
+ echo "error: line $line_num \"$line\""
|
||
|
+ echo "$output"
|
||
|
+ fi
|
||
|
done < "$CFG_FILE"
|
||
|
|
||
|
return $ret_rc
|