-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup some leaked file handles #3673
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I've only reviewed it superficially. I'm not familiar with this part of the codebase and I don't have time or willingness to investigate it more deeply, so I'll trust you on this one.
I've addressed your comments and tested redirection. I had a bug with pipes that I fixed. PVS was throwing some false positive warnings so I did some |
CI all passes now finally. I think this is good to go but I'll give you a chance to look it over again if you want @johnnovak since I made some changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looking good 😄 A few minor comments, but good job otherwise @weirddan455 👍🏻
I found this amusing, btw:
It's kind of like a DOS Valgrind because it helped me clean up some leaks.
We now handle shell redirection without creating redundant file handles. We set the fcb flag in DOS_OpenFile and set the PSP file handle manually. This allows old stdin and stdout to be correctly restored. This also prevents creating duplicate CON and NUL devices in global Files data structure.
Description
This allows Dunkle Schatten 2 to load and past the first couple of screens before it freezes. For some reason, it's very sensitive to extra files being created. It's kind of like a DOS Valgrind because it helped me clean up some leaks.
Once it gets past a certain number of files, it stomps on our device chain and then spins forever in this loop:
dosbox-staging/src/dos/dos_devices.cpp
Lines 238 to 257 in ffea16b
I haven't fixed the root problem yet but it lead me to some buggy code I could fix regardless.
Related issues
#3668
Manual testing
dir > test.txt
dir | more
test.txt < more
Checklist
Please tick the items as you have addressed them. Don't remove items; leave the ones that are not applicable unchecked.
I have: