Fixed bug in execve() on linux and bsd

This commit is contained in:
Bryan Roe 2021-02-02 22:32:09 -08:00
parent 5fd93b7b41
commit 6629a86339
2 changed files with 8 additions and 0 deletions

View File

@ -3906,6 +3906,7 @@ function linux_execv(name, agentfilename, sessionid)
var i; var i;
var args; var args;
var argarr = [process.execPath]; var argarr = [process.execPath];
var argtmp = [];
var path = require('_GenericMarshal').CreateVariable(process.execPath); var path = require('_GenericMarshal').CreateVariable(process.execPath);
if (require('MeshAgent').getStartupOptions != null) { if (require('MeshAgent').getStartupOptions != null) {
@ -3918,6 +3919,7 @@ function linux_execv(name, agentfilename, sessionid)
args = require('_GenericMarshal').CreateVariable((1 + argarr.length) * require('_GenericMarshal').PointerSize); args = require('_GenericMarshal').CreateVariable((1 + argarr.length) * require('_GenericMarshal').PointerSize);
for (i = 0; i < argarr.length; ++i) { for (i = 0; i < argarr.length; ++i) {
var arg = require('_GenericMarshal').CreateVariable(argarr[i]); var arg = require('_GenericMarshal').CreateVariable(argarr[i]);
argtmp.push(arg);
arg.pointerBuffer().copy(args.toBuffer(), i * require('_GenericMarshal').PointerSize); arg.pointerBuffer().copy(args.toBuffer(), i * require('_GenericMarshal').PointerSize);
} }
@ -3965,6 +3967,7 @@ function bsd_execv(name, agentfilename, sessionid) {
var i; var i;
var path = require('_GenericMarshal').CreateVariable(process.execPath); var path = require('_GenericMarshal').CreateVariable(process.execPath);
var argarr = [process.execPath]; var argarr = [process.execPath];
var argtmp = [];
var args; var args;
var options = require('MeshAgent').getStartupOptions(); var options = require('MeshAgent').getStartupOptions();
for (i in options) { for (i in options) {
@ -3973,6 +3976,7 @@ function bsd_execv(name, agentfilename, sessionid) {
args = require('_GenericMarshal').CreateVariable((1 + argarr.length) * require('_GenericMarshal').PointerSize); args = require('_GenericMarshal').CreateVariable((1 + argarr.length) * require('_GenericMarshal').PointerSize);
for (i = 0; i < argarr.length; ++i) { for (i = 0; i < argarr.length; ++i) {
var arg = require('_GenericMarshal').CreateVariable(argarr[i]); var arg = require('_GenericMarshal').CreateVariable(argarr[i]);
argtmp.push(arg);
arg.pointerBuffer().copy(args.toBuffer(), i * require('_GenericMarshal').PointerSize); arg.pointerBuffer().copy(args.toBuffer(), i * require('_GenericMarshal').PointerSize);
} }

View File

@ -237,6 +237,7 @@ function linux_execv(name, agentfilename, sessionid)
var i; var i;
var args; var args;
var argtmp = [];
var argarr = [process.execPath]; var argarr = [process.execPath];
var path = require('_GenericMarshal').CreateVariable(process.execPath); var path = require('_GenericMarshal').CreateVariable(process.execPath);
@ -250,6 +251,7 @@ function linux_execv(name, agentfilename, sessionid)
args = require('_GenericMarshal').CreateVariable((1 + argarr.length) * require('_GenericMarshal').PointerSize); args = require('_GenericMarshal').CreateVariable((1 + argarr.length) * require('_GenericMarshal').PointerSize);
for (i = 0; i < argarr.length; ++i) { for (i = 0; i < argarr.length; ++i) {
var arg = require('_GenericMarshal').CreateVariable(argarr[i]); var arg = require('_GenericMarshal').CreateVariable(argarr[i]);
argtmp.push(arg);
arg.pointerBuffer().copy(args.toBuffer(), i * require('_GenericMarshal').PointerSize); arg.pointerBuffer().copy(args.toBuffer(), i * require('_GenericMarshal').PointerSize);
} }
@ -298,6 +300,7 @@ function bsd_execv(name, agentfilename, sessionid) {
var i; var i;
var path = require('_GenericMarshal').CreateVariable(process.execPath); var path = require('_GenericMarshal').CreateVariable(process.execPath);
var argarr = [process.execPath]; var argarr = [process.execPath];
var argtmp = [];
var args; var args;
var options = require('MeshAgent').getStartupOptions(); var options = require('MeshAgent').getStartupOptions();
for (i in options) { for (i in options) {
@ -306,6 +309,7 @@ function bsd_execv(name, agentfilename, sessionid) {
args = require('_GenericMarshal').CreateVariable((1 + argarr.length) * require('_GenericMarshal').PointerSize); args = require('_GenericMarshal').CreateVariable((1 + argarr.length) * require('_GenericMarshal').PointerSize);
for (i = 0; i < argarr.length; ++i) { for (i = 0; i < argarr.length; ++i) {
var arg = require('_GenericMarshal').CreateVariable(argarr[i]); var arg = require('_GenericMarshal').CreateVariable(argarr[i]);
argtmp.push(arg);
arg.pointerBuffer().copy(args.toBuffer(), i * require('_GenericMarshal').PointerSize); arg.pointerBuffer().copy(args.toBuffer(), i * require('_GenericMarshal').PointerSize);
} }