mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 06:05:39 +08:00
get_hostname_identifier to not return empty hostnames
When getting the hostname to construct the legacy uvar path, if the hostname is empty, we will create a path pointing at a directory. On BSDs this path can be successfully open'd and we will produce errors about invalid uvar files.
This commit is contained in:
parent
6db631ae88
commit
9a2482557d
|
@ -981,7 +981,8 @@ bool get_hostname_identifier(wcstring &result) {
|
|||
if (gethostname(hostname, sizeof(hostname)) == 0) {
|
||||
result.assign(str2wcstring(hostname));
|
||||
result.assign(truncate(result, HOSTNAME_LEN));
|
||||
success = true;
|
||||
// Don't return an empty hostname, we may attempt to open a directory instead.
|
||||
success = !result.empty();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user