diff options
-rw-r--r-- | erts/emulator/sys/unix/erl_child_setup.c | 12 | ||||
-rw-r--r-- | erts/emulator/sys/unix/sys_drivers.c | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/erts/emulator/sys/unix/erl_child_setup.c b/erts/emulator/sys/unix/erl_child_setup.c index 71c7948bf0..8bec36be60 100644 --- a/erts/emulator/sys/unix/erl_child_setup.c +++ b/erts/emulator/sys/unix/erl_child_setup.c @@ -133,8 +133,8 @@ start_new_child(int pipes[]) o_buff = buff; - flags = *(int*)buff; - buff += sizeof(int); + flags = get_int32(buff); + buff += sizeof(Sint32); DEBUG_PRINT("flags = %d", flags); @@ -150,8 +150,8 @@ start_new_child(int pipes[]) DEBUG_PRINT("wd = %s", wd); - cnt = *(int*)buff; - buff += sizeof(int); + cnt = get_int32(buff); + buff += sizeof(Sint32); new_environ = malloc(sizeof(char*)*(cnt + 1)); for (i = 0; i < cnt; i++, buff++) { @@ -162,8 +162,8 @@ start_new_child(int pipes[]) if (o_buff + size != buff) { /* This is a spawn executable call */ - cnt = *(int*)buff; - buff += sizeof(int); + cnt = get_int32(buff); + buff += sizeof(Sint32); args = malloc(sizeof(char*)*(cnt + 1)); for (i = 0; i < cnt; i++, buff++) { args[i] = buff; diff --git a/erts/emulator/sys/unix/sys_drivers.c b/erts/emulator/sys/unix/sys_drivers.c index 8402197924..97a9c3dfaa 100644 --- a/erts/emulator/sys/unix/sys_drivers.c +++ b/erts/emulator/sys/unix/sys_drivers.c @@ -699,6 +699,7 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, io_vector[i++].iov_len = sizeof(buffsz); io_vector[i].iov_base = (void*)&flags; + flags = htonl(flags); io_vector[i++].iov_len = sizeof(flags); buffsz += sizeof(flags); @@ -715,6 +716,7 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, buffsz += io_vector[i-1].iov_len; io_vector[i].iov_base = (void*)&env_len; + env_len = htonl(env_len); io_vector[i++].iov_len = sizeof(env_len); buffsz += io_vector[i-1].iov_len; @@ -728,6 +730,7 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, if (opts->spawn_type == ERTS_SPAWN_EXECUTABLE) { io_vector[i].iov_base = (void*)&argv_len; + argv_len = htonl(argv_len); io_vector[i++].iov_len = sizeof(argv_len); buffsz += io_vector[i-1].iov_len; |