[__hostname] Fix checking of maximum hostname length against sysconf(3)

This commit is contained in:
Dennis Camera 2019-10-25 01:41:26 +02:00
parent 629d443f5a
commit d4313c7501

View file

@ -28,6 +28,8 @@ not_supported() {
os=$(cat "$__global/explorer/os")
max_len=$(cat "$__object/explorer/max_len")
if [ -f "$__object/parameter/name" ]; then
name_should="$(cat "$__object/parameter/name")"
else
@ -45,7 +47,7 @@ else
esac
fi
if test -n "${max_len}" -a "$(wc -c "${name_should}")" -gt "${max_len}"a
if test -n "${max_len}" -a "$(printf "${name_should}" | wc -c)" -gt "${max_len}"
then
printf "Host name too long. Up to %u characters allowed.\n" "${max_len}" >&2
exit 1