No description provided.
Tried adding else to close file to prevent file descriptor leak #2528
pull tariq786 wants to merge 3 commits into bitcoin:master from tariq786:my-new-branch changing 1 files +2 −0-
tariq786 commented at 6:57 PM on April 14, 2013: none
-
Tried adding else to close file to prevent file descriptor leak 199a8af659
-
added else if with NULL condition check 479aeb697c
-
Fixed indentation in else if d0307c46f4
-
in src/util.cpp:None in 199a8af659 outdated
1230 | @@ -1231,6 +1231,8 @@ void ShrinkDebugFile() 1231 | fclose(file); 1232 | } 1233 | } 1234 | + else 1235 | + fclose(file);
laanwj commented at 7:05 PM on April 14, 2013:This fix is not correct. It indeed looks like there is currently a fd leak when
file && GetFilesize(file) < 10 * 1000000, but your change would also cause a fclose in the case that file == NULL (when the debug log cannot be opened; resulting in a segmentation fault).in src/util.cpp:None in 479aeb697c outdated
1230 | @@ -1231,6 +1231,8 @@ void ShrinkDebugFile() 1231 | fclose(file); 1232 | } 1233 | } 1234 | + else if(file != NULL)
Diapolo commented at 7:19 PM on April 14, 2013:IMHO it would be sufficient to write:
else if (file)And please also check your indentation below!
tariq786 commented at 7:24 PM on April 14, 2013:i have done the same (IMHO) and fixed the indentation issue as well
laanwj commented at 7:42 PM on April 14, 2013: memberACK
Diapolo commented at 8:26 PM on April 14, 2013: noneYou need to squash the 2 commits into one and I still see the indentation issue?
sipa commented at 10:19 PM on April 15, 2013: memberACK, if you squash the commits together.
BitcoinPullTester commented at 1:06 AM on April 16, 2013: noneAutomatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/d0307c46f4013f7d60e505e3a1c737ebd6788203 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
laanwj cross-referenced this on Apr 27, 2013 from issue Prevent prevent file descriptor leak in ShrinkDebugFile() by laanwjlaanwj closed this on Apr 27, 2013bitcoin locked this on Sep 8, 2021ContributorsMilestone
v0.8.2
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC