Skip to content

Commit

Permalink
spawn/IProtocol: add EXEC_PATH
Browse files Browse the repository at this point in the history
The `exec_path` field never worked because it was never copied to the
server.
  • Loading branch information
MaxKellermann committed Oct 23, 2023
1 parent adf620b commit 719f80c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/spawn/Client.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ Serialize(SpawnSerializer &s, const PreparedChildProcess &p)

s.WriteOptionalString(SpawnExecCommand::HOOK_INFO, p.hook_info);

s.WriteOptionalString(SpawnExecCommand::EXEC_PATH, p.exec_path);

for (const char *i : p.args)
s.WriteString(SpawnExecCommand::ARG, i);

Expand Down
1 change: 1 addition & 0 deletions src/spawn/IProtocol.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ enum class SpawnRequestCommand : uint8_t {
};

enum class SpawnExecCommand : uint8_t {
EXEC_PATH,
ARG,
SETENV,
UMASK,
Expand Down
4 changes: 4 additions & 0 deletions src/spawn/Server.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,10 @@ SpawnServerConnection::HandleExecMessage(SpawnPayload payload,
while (!payload.empty()) {
const SpawnExecCommand cmd = (SpawnExecCommand)payload.ReadByte();
switch (cmd) {
case SpawnExecCommand::EXEC_PATH:
p.exec_path = payload.ReadString();
break;

case SpawnExecCommand::ARG:
if (p.args.size() >= 16384)
throw MalformedSpawnPayloadError();
Expand Down

0 comments on commit 719f80c

Please sign in to comment.