Skip to content

Commit 02eb604

Browse files
committed
Platform (Linux): use $HOSTNAME if available
Ref: #710
1 parent ce6b2b8 commit 02eb604

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/util/platform/FFPlatform_unix.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ static void getUserName(FFPlatform* platform, const struct passwd* pwd)
150150

151151
static void getHostName(FFPlatform* platform, const struct utsname* uts)
152152
{
153-
ffStrbufAppendS(&platform->hostName, uts->nodename);
153+
const char* hostname = getenv("HOSTNAME");
154+
if(!ffStrSet(hostname) && uts)
155+
hostname = uts->nodename;
156+
ffStrbufAppendS(&platform->hostName, hostname);
154157
}
155158

156159
static void getUserShell(FFPlatform* platform, const struct passwd* pwd)

0 commit comments

Comments
 (0)