fix 'n' overwrite option crashing + no return in ProcessFile

ProcessFile always returns 1 though, so Errors is always gonna be 0...

meh
This commit is contained in:
Alex Baines 2017-04-30 03:28:45 +01:00
parent 01d179f77f
commit c78193b74f
1 changed files with 4 additions and 2 deletions

View File

@ -400,6 +400,8 @@ int ProcessFile(char *InFileName, FILE *InFile, FILE *OutFile)
Done:
fputs("[/video]\n", OutFile);
free(Contents);
return 1;
}
int main(int ArgC, char **Args)
@ -442,7 +444,7 @@ int main(int ArgC, char **Args)
char OutNameBuf[strlen(OutDirName) + strlen(FileNameBase) + 7];
sprintf(OutNameBuf, "%s/%s.hmml", OutDirName, FileNameBase);
FILE *OutFile;
FILE *OutFile = NULL;
{
int OpenFlags = O_CREAT | O_EXCL | O_WRONLY;
@ -479,7 +481,7 @@ OpenOutput:;
fprintf(stderr, "Error opening %s: %s\n", Args[i], strerror(errno));
}
if(!InFile || !OutFile || !ProcessFile(FileNameBase, InFile, OutFile))
if(InFile && OutFile && !ProcessFile(FileNameBase, InFile, OutFile))
{
++Errors;
}