Don't pass NULL f to fclose, passing --no-clobber if file doesn't exist

This commit is contained in:
baldurk
2018-01-02 16:29:23 +00:00
parent 9013c1babf
commit dec06a19fb
+7 -3
View File
@@ -998,10 +998,14 @@ struct EmbeddedSectionCommand : public Command
if(noclobber)
{
bool exists = false;
f = fopen(file.c_str(), "rb");
bool exists = (f != NULL);
fclose(f);
f = NULL;
if(f)
{
exists = true;
fclose(f);
f = NULL;
}
if(exists)
{