Skip to content
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

firewall: T1241: Check file before del #18

Merged
merged 1 commit into from Jul 29, 2020
Merged

Conversation

sever-sever
Copy link
Member

Check if the file exists before deleting.

@@ -293,7 +293,7 @@ sub write_refcnt_file {
print $FILE join("\n", @lines), "\n";
close($FILE);
} else {
system("rm $refcnt_file");
system("[ -e $refcnt_file ] && rm $refcnt_file");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not overuse system(). Built-in functions are always faster: unlink($refcnt_file) if -e $refcnt_file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmbaturin Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants