seccomp.sh: Try to account for terminal width while formatting list of system calls
Avoid excess lines on wide terminals, but make sure we don't fail if we can't fetch the number of columns for any reason, as it's not a fundamental feature and we don't want to break anything with it. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
e0be6bc2f4
commit
712ca32353
1 changed files with 4 additions and 1 deletions
|
@ -242,7 +242,10 @@ for __p in ${__profiles}; do
|
|||
__calls="$(sed -n 's/[\t ]*\*[\t ]*#syscalls\(:'"${__p}"'\|\)[\t ]\{1,\}\(.*\)/\2/p' ${IN})"
|
||||
__calls="${__calls} ${EXTRA_SYSCALLS:-}"
|
||||
__calls="$(filter ${__calls})"
|
||||
echo "seccomp profile ${__p} allows: ${__calls}" | tr '\n' ' ' | fmt -t
|
||||
|
||||
cols="$(stty -a | sed -n 's/.*columns \([0-9]*\).*/\1/p' || :)" 2>/dev/null
|
||||
case $cols in [0-9]*) col_args="-w ${cols}";; *) col_args="";; esac
|
||||
echo "seccomp profile ${__p} allows: ${__calls}" | tr '\n' ' ' | fmt -t ${col_args}
|
||||
|
||||
# Pad here to keep gen_profile() "simple"
|
||||
__count=0
|
||||
|
|
Loading…
Reference in a new issue