Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up sandbox dir safely
Browse files Browse the repository at this point in the history
Move out of the sandbox directory before trying to remove it; this is
required on Windows, where you cannot remove a directory that you're
chdir'd into.
ethomson committed Jan 22, 2025
1 parent 04ccb37 commit d9cd8ca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clar/sandbox.h
Original file line number Diff line number Diff line change
@@ -233,12 +233,12 @@ static int clar_sandbox_cleanup(void)
{
cl_assert(_clar_sandbox[0] != '\0');

fs_rm(_clar_sandbox);
_clar_sandbox[0] = '\0';

if (chdir(_clar_tempdir) != 0)
return -1;

fs_rm(_clar_sandbox);
_clar_sandbox[0] = '\0';

return 0;
}

0 comments on commit d9cd8ca

Please sign in to comment.