mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
Fix #1668
This commit is contained in:
@@ -603,6 +603,11 @@ lnodename(lua_State *L) {
|
||||
pid_t pid = getpid();
|
||||
char hostname[256];
|
||||
if (gethostname(hostname, sizeof(hostname))==0) {
|
||||
int i;
|
||||
for (i=0; hostname[i]; i++) {
|
||||
if (hostname[i] <= ' ')
|
||||
hostname[i] = '_';
|
||||
}
|
||||
lua_pushfstring(L, "%s%d", hostname, (int)pid);
|
||||
} else {
|
||||
lua_pushfstring(L, "noname%d", (int)pid);
|
||||
|
||||
Reference in New Issue
Block a user