Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/emu/x64int3.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ x64emu_t* x64emu_fork(x64emu_t* emu, int forktype)
// error...
} else if(v!=0) {
// execute atforks parent functions
for (int i=0; i<my_context->atfork_sz; --i)
for (int i=0; i<my_context->atfork_sz; ++i)
if(my_context->atforks[i].parent)
EmuCall(emu, my_context->atforks[i].parent);
if(forktype==3) {
Expand All @@ -68,7 +68,7 @@ x64emu_t* x64emu_fork(x64emu_t* emu, int forktype)
}
} else if(v==0) {
// execute atforks child functions
for (int i=0; i<my_context->atfork_sz; --i)
for (int i=0; i<my_context->atfork_sz; ++i)
if(my_context->atforks[i].child)
EmuCall(emu, my_context->atforks[i].child);
}
Expand Down
13 changes: 7 additions & 6 deletions src/wrapped/wrappedlibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,13 +598,13 @@ pid_t EXPORT my_fork(x64emu_t* emu)
// error...
} else if(v>0) {
// execute atforks parent functions
for (int i=0; i<my_context->atfork_sz; --i)
for (int i=0; i<my_context->atfork_sz; ++i)
if(my_context->atforks[i].parent)
RunFunctionWithEmu(emu, 0, my_context->atforks[i].parent, 0);

} else /*if(v==0)*/ {
// execute atforks child functions
for (int i=0; i<my_context->atfork_sz; --i)
for (int i=0; i<my_context->atfork_sz; ++i)
if(my_context->atforks[i].child)
RunFunctionWithEmu(emu, 0, my_context->atforks[i].child, 0);
}
Expand Down Expand Up @@ -2819,10 +2819,11 @@ EXPORT int32_t my___register_atfork(x64emu_t *emu, void* prepare, void* parent,
my_context->atfork_cap += 4;
my_context->atforks = (atfork_fnc_t*)box_realloc(my_context->atforks, my_context->atfork_cap*sizeof(atfork_fnc_t));
}
my_context->atforks[my_context->atfork_sz].prepare = (uintptr_t)prepare;
my_context->atforks[my_context->atfork_sz].parent = (uintptr_t)parent;
my_context->atforks[my_context->atfork_sz].child = (uintptr_t)child;
my_context->atforks[my_context->atfork_sz].handle = handle;
int i = my_context->atfork_sz++;
my_context->atforks[i].prepare = (uintptr_t)prepare;
my_context->atforks[i].parent = (uintptr_t)parent;
my_context->atforks[i].child = (uintptr_t)child;
my_context->atforks[i].handle = handle;
return 0;
}

Expand Down
13 changes: 7 additions & 6 deletions src/wrapped32/wrappedlibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,13 +719,13 @@ pid_t EXPORT my32_fork(x64emu_t* emu)
// error...
} else if(v>0) {
// execute atforks parent functions
for (int i=0; i<my_context->atfork_sz; --i)
for (int i=0; i<my_context->atfork_sz; ++i)
if(my_context->atforks[i].parent)
RunFunctionWithEmu(emu, 0, my_context->atforks[i].parent, 0);

} else /*if(v==0)*/ {
// execute atforks child functions
for (int i=0; i<my_context->atfork_sz; --i)
for (int i=0; i<my_context->atfork_sz; ++i)
if(my_context->atforks[i].child)
RunFunctionWithEmu(emu, 0, my_context->atforks[i].child, 0);
}
Expand Down Expand Up @@ -2609,10 +2609,11 @@ EXPORT int32_t my32___register_atfork(x64emu_t *emu, void* prepare, void* parent
my_context->atfork_cap += 4;
my_context->atforks = (atfork_fnc_t*)realloc(my_context->atforks, my_context->atfork_cap*sizeof(atfork_fnc_t));
}
my_context->atforks[my_context->atfork_sz].prepare = (uintptr_t)prepare;
my_context->atforks[my_context->atfork_sz].parent = (uintptr_t)parent;
my_context->atforks[my_context->atfork_sz].child = (uintptr_t)child;
my_context->atforks[my_context->atfork_sz].handle = handle;
int i = my_context->atfork_sz++;
my_context->atforks[i].prepare = (uintptr_t)prepare;
my_context->atforks[i].parent = (uintptr_t)parent;
my_context->atforks[i].child = (uintptr_t)child;
my_context->atforks[i].handle = handle;
return 0;
}

Expand Down
Loading