summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2021-02-06 09:37:01 +1100
committerDarren Tucker <dtucker@dtucker.net>2021-02-06 09:37:01 +1100
commitf88a7a431212a16e572ecabd559e632f369c363e (patch)
tree07b280969f48d03a1f00041314cb70fd9a67715a
parent5e385a71ef2317856f37c91a98658eb12eb5a89c (diff)
Add a hostname function for systems that don't have it.
Some systems don't have a hostname command (it's not required by POSIX). The do have uname -n (which is), but as found by tim@ some others (eg UnixWare) do not report the FQDN from uname -n.
-rw-r--r--regress/test-exec.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index ee47f572..db5d2f9c 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -323,6 +323,15 @@ md5 () {
wc -c
fi
}
+
+# Some platforms don't have hostname at all, but on others uname -n doesn't
+# provide the fully qualified name we need, so in the former case we create
+# our own hostname function.
+if ! have_prog hostname; then
+ hostname() {
+ uname -n
+ }
+fi
# End of portable specific functions
stop_sshd ()