Skip to content

Commit

Permalink
Use std::vector instead of variable-length array
Browse files Browse the repository at this point in the history
Resolves #3802
  • Loading branch information
rocallahan committed Aug 27, 2024
1 parent 31c82c8 commit aac3163
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/FdTable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ void FdTable::init_syscallbuf_fds_disabled(Task* t) {
return;
}

char disabled[syscallbuf_fds_disabled_size];
memset(disabled, 0, sizeof(disabled));
vector<char> disabled;
disabled.resize(syscallbuf_fds_disabled_size, 0);

// It's possible that some tasks in this address space have a different
// FdTable. We need to disable syscallbuf for an fd if any tasks for this
Expand All @@ -249,8 +249,8 @@ void FdTable::init_syscallbuf_fds_disabled(Task* t) {
}

auto addr = REMOTE_PTR_FIELD(t->preload_globals, syscallbuf_fd_class[0]);
rt->write_mem(addr, disabled, syscallbuf_fds_disabled_size);
rt->record_local(addr, disabled, syscallbuf_fds_disabled_size);
rt->write_mem(addr, disabled.data(), syscallbuf_fds_disabled_size);
rt->record_local(addr, disabled.data(), syscallbuf_fds_disabled_size);
}

void FdTable::close_after_exec(ReplayTask* t, const vector<int>& fds_to_close) {
Expand Down

0 comments on commit aac3163

Please sign in to comment.