Explorar o código

Windows needs remove before rename

Czajkowski, Piotr %!s(int64=5) %!d(string=hai) anos
pai
achega
4e181234f0
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      zip.c

+ 2 - 0
zip.c

@@ -67,6 +67,7 @@ int anonymize(const char *infile, char *outfile) {
 
 		const char *outfile = "tmpFile.docx";
 		processDOCX(infile, outfile);
+		remove(infile);
 		rename(outfile, infile);
 	} else {
 		strcat(binnFile, outfile);
@@ -84,6 +85,7 @@ int deanonymize(const char *infile, char *outfile) {
 	if (!outfile || strcmp(infile, outfile) == 0){
 		const char *outfile = "tmpFile.docx";
 		processDOCX(infile, outfile);
+		remove(infile);
 		rename(outfile, infile);
 	} else {
 		processDOCX(infile, outfile);