Open nickhuang99 opened 3 months ago
I am not very sure about this "possible race condition" from CodeFactor (Possible race condition (CWE-362, CWE-20) (flawfinder7-readlink)). My guess is that this is only an improvement of one case when symlink already created. Say there is a race condition that a symlink is created after test is done so that we end up as the same exception. But this is NO WORSE than current code. So, I see no harm of this extra test to reduce some exception-throwing. It is NOT perfect solution, but just an improvement.
In case zimdump run repeatedly, the symlink could be created already. So, before throwing exception, better to call "readLink" to check symlink.