For -q option, as man grep says: Exit immediately with zero status if any match is found, even if an error was detected. So when matching, the read side of pipe is closed by "grep -q", while the write side still try to write more data, which cause SIGPIPE to the process, and the shell can not exit with 0.
Signed-off-by: Pingfan Liu piliu@redhat.com --- kdumpctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 4d68be0..c755835 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1126,7 +1126,7 @@ start() return 1 fi
- if sestatus 2>/dev/null | grep -q "SELinux status.*enabled"; then + if [ $((sestatus | grep "SELinux status.*enabled") &> /dev/null) ]; then selinux_relabel fi save_raw