Check supplied hostname before using it.

This is start of making libcontainer work with some or no namespaces enabled.

Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)