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