mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1172467: Fix an IPC channel file descriptor leak from Nuwa to the child process. r=khuey
This commit is contained in:
parent
e3ecdbc77a
commit
9335f69953
@ -375,17 +375,16 @@ ProcLoaderLoadRunner::ShuffleFds()
|
||||
|
||||
MOZ_ASSERT(mFdsRemap.Length() <= kReservedFileDescriptors);
|
||||
|
||||
InjectiveMultimap fd_shuffle1, fd_shuffle2;
|
||||
fd_shuffle1.reserve(mFdsRemap.Length());
|
||||
fd_shuffle2.reserve(mFdsRemap.Length());
|
||||
InjectiveMultimap fd_shuffle;
|
||||
fd_shuffle.reserve(mFdsRemap.Length());
|
||||
|
||||
for (i = 0; i < mFdsRemap.Length(); i++) {
|
||||
const FDRemap *map = &mFdsRemap[i];
|
||||
int fd = map->fd().PlatformHandle();
|
||||
int tofd = map->mapto();
|
||||
|
||||
fd_shuffle1.push_back(InjectionArc(fd, tofd, false));
|
||||
fd_shuffle2.push_back(InjectionArc(fd, tofd, false));
|
||||
// The FD that is dup2()'d from needs to be closed after shuffling.
|
||||
fd_shuffle.push_back(InjectionArc(fd, tofd, /*in_close=*/true));
|
||||
|
||||
// Erase from sReservedFds we will use.
|
||||
for (int* toErase = sReservedFds->begin();
|
||||
@ -398,7 +397,7 @@ ProcLoaderLoadRunner::ShuffleFds()
|
||||
}
|
||||
}
|
||||
|
||||
DebugOnly<bool> ok = ShuffleFileDescriptors(&fd_shuffle1);
|
||||
DebugOnly<bool> ok = ShuffleFileDescriptors(&fd_shuffle);
|
||||
|
||||
// Close the FDs that are reserved but not used after
|
||||
// ShuffleFileDescriptors().
|
||||
|
Loading…
Reference in New Issue
Block a user