1
0
Fork 0
forked from wry/wry

Merge pull request #760 from mahkoh/jorth/reexec2

reexec: ensure that pipe file descriptors are not overwritten
This commit is contained in:
mahkoh 2026-02-25 19:37:04 +01:00 committed by GitHub
commit 39289cdd44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -68,7 +68,7 @@ impl JayReexec {
{
drop(p2);
fds.sort_by_key(|fd| fd.raw());
let c2_dup = fds.last().unwrap().raw() + 1;
let c2_dup = c1.raw().max(c2.raw()).max(fds.last().unwrap().raw()) + 1;
let c1_dup = c2_dup + 1;
let _ = dup2(c1.raw(), c1_dup);
let _ = dup2(c2.raw(), c2_dup);