1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 07:43:50 +00:00

Fixed bug with os.hostname()

This commit is contained in:
Bryan Roe
2019-06-24 16:45:30 -07:00
parent 7237586206
commit fc8fba9f62

View File

@@ -1594,8 +1594,14 @@ duk_ret_t ILibDuktape_ScriptContainer_OS_networkInterfaces(duk_context *ctx)
duk_ret_t ILibDuktape_ScriptContainer_OS_hostname(duk_context *ctx)
{
char name[1024];
int len = gethostname(name, (int)sizeof(name));
duk_push_lstring(ctx, name, len);
if (gethostname(name, (int)sizeof(name)) == 0)
{
duk_push_string(ctx, name);
}
else
{
duk_push_string(ctx, "");
}
return(1);
}
void ILibDuktape_ScriptContainer_OS_Push(duk_context *ctx, void *chain)