application won't stop sometimes

Node won't stop if wm_name set in .conf file, like for example {wm_name, leader}. This happens because rpc:call() requires qualified node name such as name@hostname when node started with -sname or name@hostname.full when node started with -name.

In default configuration it works because io_lib:format("~s@~s", [app_name(AppFile), host_name()]) makes full qualified name like appname@hostname.

This commit fixes this problem, it allows to start and stop node when:

1. wm_name is not set (in this case node starts with -sname appname), rpc:call() makes a call to appname@hostname
2. wm_name is set (in this case node starts with -name wm_name), rpc:call() makes a call to wm_name@hostname.full
3. wm_sname is set (in this case node starts with -sname wm_name), rpc:call() makes a call to wm_name@hostname

hostname is a return value of {ok, Hostname} = inet:gethostname()
hostname.full is a return value of HostnameFull = net_adm:localhost()

In all three cases start, stop and restart commands work correctly on two my Linux boxes with Erlang R15B01 and R15B03.

Further testing is probably required, as it may depend on OS host configuration.