forked from ungleich-public/cdist
[__hostname] Fix checking of maximum hostname length against sysconf(3)
This commit is contained in:
parent
629d443f5a
commit
d4313c7501
1 changed files with 3 additions and 1 deletions
|
@ -28,6 +28,8 @@ not_supported() {
|
||||||
|
|
||||||
|
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
|
max_len=$(cat "$__object/explorer/max_len")
|
||||||
|
|
||||||
if [ -f "$__object/parameter/name" ]; then
|
if [ -f "$__object/parameter/name" ]; then
|
||||||
name_should="$(cat "$__object/parameter/name")"
|
name_should="$(cat "$__object/parameter/name")"
|
||||||
else
|
else
|
||||||
|
@ -45,7 +47,7 @@ else
|
||||||
esac
|
esac
|
||||||
fi
|
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
|
then
|
||||||
printf "Host name too long. Up to %u characters allowed.\n" "${max_len}" >&2
|
printf "Host name too long. Up to %u characters allowed.\n" "${max_len}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in a new issue