Page MenuHomePhabricator

[libcxx] Portability fix: close an open file stream before removing the file.

Authored by amakc11 on Feb 27 2019, 11:53 AM.



The C standard says the following in the specification of the remove function: "If the file is open, the behavior of the remove function is implementation-defined". The recently added test fopens a file, but does not close it before calling the std::remove function on this file, thus making this test dependent on the type of filesystem used for running the test suite. This patch adds the missing std::fclose call. BTW, it's a good practice of clean programming.

Diff Detail

rCXX libc++

Event Timeline

amakc11 created this revision.Feb 27 2019, 11:53 AM
mclow.lists accepted this revision.Feb 27 2019, 3:41 PM
mclow.lists added a subscriber: mclow.lists.

This looks fine to me.

This revision is now accepted and ready to land.Feb 27 2019, 3:41 PM
ldionne accepted this revision.Feb 28 2019, 5:27 PM

BTW, it's a good practice of clean programming.

Indeed, this was just a mistake on my part. Thanks for fixing.

This revision was automatically updated to reflect the committed changes.