I think this should be done only if we're on such an OS *and* if the `gethostname` result begins with `nodename `.

Counterexample on Linux: sometimes hosts are named `X` and then have interfaces named `be0` with a DNS name `X-be0`.  Your code would overwrite the proper node name with something else based on what `gethostname` thinks.